home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Information / THINK C Digest / 1993 / 93-04 < prev    next >
Text File  |  1995-12-31  |  138KB  |  3,551 lines

  1. 
  2. Path: ucivax!gateway
  3. From: yarri@icrl.mew.mei.co.jp (Douglas Yarrington)
  4. Subject: After Dark Dev
  5. Message-ID: <9304010535.AA01335@solbol.icrl.mew.mei.co.jp>
  6. X-Mailer: ELM [version 2.3 PL11]
  7. Newsgroups: fa.think-c
  8. Lines: 18
  9. Date: 1 Apr 93 05:40:28 GMT
  10.  
  11. Hello.
  12.  
  13. I've had some inspiration of late to produce an After Dark screen saver
  14. module that will, hopefully, represent some of my experiences in Japan: for
  15. example, no one here really understands what the "Mowin' Man" is. So I'd
  16. like to give them something.
  17.  
  18. Can someone tell me where the After Dark dev kit is these days? Times were
  19. it used to be on ftp sites. Has Berkely Systems removed this from pd? If
  20. so, how do I obtain a dev kit for ThinkC.
  21.  
  22. Thanks.
  23.  
  24. --douglas
  25.  
  26.   Douglas Yarrington                                 yarri@icrl.mew.mei.co.jp
  27.   IBS Systems - Digital Design                             Flat Antenna Stuff
  28.   Matsushita Electric Works, Ltd        "A beautiful place to be for a while"
  29. 
  30. 
  31. Path: ucivax!gateway
  32. From: C2MXBAR@fre.towson.edu (Aaron Barnett)
  33. Subject: assembly books
  34. Message-ID: <01GWHX5ZDFS2934SBY@TOE.TOWSON.EDU>
  35. Content-transfer-encoding: 7BIT
  36. MIME-version: 1.0
  37. Newsgroups: fa.think-c
  38. X-VMS-To: THINK
  39. Lines: 3
  40. Date: 1 Apr 93 17:52:43 GMT
  41. X-Envelope-to: think-c@ics.uci.edu
  42.  
  43. can anyone recomend a good book/reference on 68xxx assembly?
  44.  
  45. aaron
  46. 
  47. 
  48. Path: ucivax!gateway
  49. From: MRUHL@hermes.ece.arizona.edu ("The sky is ecstasy dancing...")
  50. Subject: Control icons in a standard window.
  51. Message-ID: <930401114313.27616183@HERMES.ECE.ARIZONA.EDU>
  52. Newsgroups: fa.think-c
  53. Lines: 20
  54. Date: 1 Apr 93 18:43:25 GMT
  55. X-Vmsmail-To: SMTP%"think-c@ics.uci.edu"
  56.  
  57. Hi,
  58.    I am trying to add controls to a window, and am not being very successful.
  59. What I would like to do is use icons as push buttons.  The way that I am
  60. currently doing this is to record were the rect of the icon is located on the
  61. window, and then check to see if the mouse was clicked on that rect.
  62.  
  63.    Since these are controls, I would like to add them to the control list of the
  64. window, and deal with them through FindControl etc.  What I was wondering is,
  65. is there an easier way of doing this than creating my own control definitions,
  66. or if creating a control definition is the only way, would someone send me an
  67. example, cause I am failing miserably at figuring out how to create one.
  68.  
  69. Thanks,
  70.   Mike
  71.  
  72. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  73. mruhl@hermes.ece.arizona.edu        Loose cannon and programmer of Vaxes
  74. ece_0263@bigdog.engr.arizona.edu    I don't work for anybody, so I don't
  75. mruhl@alpha.sunquest.com        need a disclaimer.
  76. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  77. 
  78. 
  79. Path: ucivax!gateway
  80. From: jgarner@seattleu.edu (Jeff Garner)
  81. Subject: Finding Mac's Name.
  82. Message-ID: <Pine.3.03.9304011632.A19708-a100000@sumax.seattleu.edu>
  83. In-Reply-To: <01GWHX5ZDFS2934SBY@TOE.TOWSON.EDU>
  84. Content-Type: TEXT/PLAIN; charset=US-ASCII
  85. Mime-Version: 1.0
  86. Newsgroups: fa.think-c
  87. Lines: 16
  88. Date: 2 Apr 93 00:16:43 GMT
  89.  
  90.  
  91. I'd like to find the name of the Mac, as specified in the Sharing Setup
  92. control panel.  I'd prefer not using an AppleTalk command, since AppleTalk
  93. could be off during the program's use.
  94.  
  95. I've looked in IM VI, New TNs, CSMP digests, and other places...
  96.  
  97. I know where the info gets stored... in the Users & Groups Data File in
  98. the Prefs folder...  but surely there's an easier way than hacking the
  99. data file!
  100.  
  101. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  102. Jeff Garner     Shoestring Software Products   jgarner@seattleu.edu
  103. (206) 232-1096   Mercer Island, Washington     jgarner@visual.spk.wa.us
  104.  
  105.  
  106. 
  107. 
  108. Path: ucivax!gateway
  109. From: resnick@cogsci.uiuc.edu (Pete Resnick)
  110. Subject: Re: Finding Mac's Name.
  111. Message-ID: <199304020254.AA24446@tarski.cogsci.uiuc.edu>
  112. In-Reply-To: <Pine.3.03.9304011632.A19708-a100000@sumax.seattleu.edu>; from "Jeff Garner" at Apr 2, 93 12:16 am
  113. X-Mailer: ELM [version 2.3 PL11]
  114. Newsgroups: fa.think-c
  115. Lines: 13
  116. Date: 2 Apr 93 02:54:51 GMT
  117.  
  118. > I'd like to find the name of the Mac, as specified in the Sharing Setup
  119. > control panel.  I'd prefer not using an AppleTalk command, since AppleTalk
  120. > could be off during the program's use.
  121.  
  122. See IM VI, p. 13-15. It's System 'STR ' resource -16413. It's also in
  123. the "What's New With AppleTalk Phase 2" Tech note.
  124.  
  125. pr
  126. --
  127. Pete Resnick             (...so what is a mojo, and why would one be rising?)
  128. Graduate assistant - Philosophy Department, Gregory Hall, UIUC
  129. System manager - Cognitive Science Group, Beckman Institute, UIUC
  130. Internet: resnick@cogsci.uiuc.edu
  131. 
  132. 
  133. Path: ucivax!gateway
  134. From: k.c.quick@open.ac.uk (Kevin Quick)
  135. Subject: List Manager
  136. Via: uk.ac.open; Fri, 2 Apr 1993 15:25:37 +0100
  137. X-Sender: kc_quick@sunflower
  138. Message-ID: <9304021427.AA06629@sunflower.open.ac.uk>
  139. X-Mailer: Eudora 1.3.1
  140. Newsgroups: fa.think-c
  141. Lines: 11
  142. Date: 2 Apr 93 14:27:43 GMT
  143.  
  144. Does anybody have some example code in TC for calling the list manager to
  145. set up a new list.
  146.  
  147. Thanks in Advance.
  148.  
  149. Kevin Quick
  150. Computer Support Engineer
  151. The Open University
  152.  
  153. Mail by Eudora 1.3
  154.  
  155. 
  156. 
  157. Path: ucivax!gateway
  158. From: hurtz@mcl.mcl.ucsb.edu (Gary Hurtz)
  159. Subject: I want out of the mailing list
  160. Message-ID: <Pine.3.05.9304020915.A29758-8100000@mcl.mcl.ucsb.edu>
  161. Content-Type: TEXT/PLAIN; charset=US-ASCII
  162. Mime-Version: 1.0
  163. Newsgroups: fa.think-c
  164. Lines: 8
  165. Date: 2 Apr 93 17:50:04 GMT
  166.  
  167. I tried mailing the address that was given out last week, but im still not
  168. off of the list.  I dont have that address anymore, so sorry I had to do
  169. it this way.
  170.  
  171. please remove me, hurtz@mcl.mcl.ucsb.edu
  172.  
  173.  
  174.  
  175. 
  176. 
  177. Path: ucivax!gateway
  178. From: apex@netcom.com (Apex Voice Communications)
  179. Subject: Take my address off the mail list
  180. Message-ID: <9304022348.AA19050@netcom2.netcom.com>
  181. Newsgroups: fa.think-c
  182. Lines: 5
  183. Date: 2 Apr 93 23:48:46 GMT
  184.  
  185.  
  186. Please take me off of the think c list.
  187.  
  188. apex@netcom.com
  189.  
  190. 
  191. 
  192. Path: ucivax!gateway
  193. From: Jean-Marie.Laborde@imag.fr (Jean-Marie Laborde)
  194. Subject: Code for Error String 1 (at last)
  195. Message-ID: <199304050601.AA18182@isis.imag.fr>
  196. Newsgroups: fa.think-c
  197. Organization: IMAG Institute, University of Grenoble, France
  198. Lines: 243
  199. Date: 5 Apr 93 06:01:29 GMT
  200.  
  201. Here is code for ErrorStrings I promissed last month.
  202. Please excuse the delay due to too much work (but is not very specific).
  203.  
  204. The stuff has 2 parts,
  205. o------one is the code of 3 functions message(), FiltreDial() and
  206. extraction_texte_erreur()
  207. contained in the file message.c transmitted separately;
  208.  
  209. 0-----the other is this message containing a text description of the required
  210. resource file, to be SAResed.
  211.  
  212. I did not incorporated the 28K string to this message.r because the
  213. corresponding
  214. file would have been huge (142K), so after recompiling the resource
  215. and obtained a message.rsrc file you should add to it the TEXT resource with
  216. ID 128
  217. containing the chain at the end of this message and starting with
  218.  
  219. DS Table
  220. 1     dsBusError - bus error
  221. 2     dsAddressErr - address error
  222. 3     dsIllInstErr - illegal instruction error
  223.  
  224. end ending with
  225.  
  226. Primary or Secondary Init Code
  227. -32768 svTempDisable - Temporarily disable card but run primary init
  228. -32640 svDisabled - Reserve -32640 to -32768 for Apple temp disables
  229.  
  230. Next is a sample code to test message():
  231. ****************************************************************************
  232. OSErr   myOSErr;
  233. void    message(char *chaine,...);
  234.  
  235. void main()
  236. {
  237.         InitGraf(&thePort);
  238.         InitWindows();
  239.         InitFonts();
  240.         InitDialogs(0L);
  241.         InitCursor();
  242.         TEInit();
  243.  
  244.         PrintErr=0;             /* an alternative solution is a call of type
  245. PrOpen();PrClose();
  246.                                            instead of PrintErr=noErr;
  247. //noErr==0 */
  248.  
  249.         {
  250.                 long longint=1234567890;
  251.                 char mychar='a';
  252.                 long lgchar='APPL';
  253.  
  254.                 myOSErr=1;
  255.                 message("%err with context\nvalue of longint is %ld\nvalue of mychar is %c\nvalue of lgchar is %lc",longint,mychar,lgchar);
  256.         }
  257. }
  258. ****************************************************************************
  259.  
  260.  
  261. The way to use the stuff can be found at the beginning of the file message.c
  262. The way to recompile the resource using SARez is the following:
  263.         -start SARez
  264.         -click the pull-down menu rez.out and choose "Write output to a new
  265. file"
  266.                         give the name message.rsrc for the new file
  267.         -enter rsrc for the Type (default APPL)
  268.         -enter RSED for the Creator (default ????)
  269.         -if you do not use Resedit, but e.g. Resorcerer, type RSRC and Doug
  270. instead
  271.         -Push the button Description files... and add the file
  272.                 message.r to the list of description file
  273.         -Push the button #include Paths... and add the folder RIncludes to
  274. paths.
  275.         -Press button SARez,   it should work.
  276.  
  277. Begin of the contents of the required text file message.r to run SARez:
  278. /****************************************************************************/
  279. resource 'DITL' (128) {
  280.         {       /* array DITLarray: 4 elements */
  281.                 /* [1] */
  282.                 {60, 48, 82, 162},
  283.                 Button {
  284.                         enabled,
  285.                         "Resume"
  286.                 },
  287.                 /* [2] */
  288.                 {60, 196, 81, 306},
  289.                 Button {
  290.                         enabled,
  291.                         "ExitToShell()"
  292.                 },
  293.                 /* [3] */
  294.                 {60, 344, 80, 440},
  295.                 Button {
  296.                         enabled,
  297.                         "Debug"
  298.                 },
  299.                 /* [4] */
  300.                 {16, 20, 44, 463},
  301.                 UserItem {
  302.                         enabled
  303.                 }
  304.         }
  305. };
  306.  
  307. resource 'DLOG' (128, "Message") {
  308.         {40, 24, 134, 497},
  309.         altDBoxProc,
  310.         invisible,
  311.         noGoAway,
  312.         0x0,
  313.         128,
  314.         "OSEerr"
  315. };
  316.  
  317. data 'TEXT' (128) {
  318.         $"4453 2054 6162 6C65 0D31 2020 2020 2064"            /* DS TableB1
  319.  d */
  320.         /* .......... */
  321.         $"6162 6C65 73"                                       /* ables */
  322. };
  323. /****************************************************************************/
  324. end of the contain of file message.r to run SARez.
  325.  
  326. You finally need the 28K long chain giving the textual interpretation of
  327. all the error codes.
  328. Following is the begin and the end of it
  329. /****************************************************************************/
  330. DS Table
  331. 1     dsBusError - bus error
  332. 2     dsAddressErr - address error
  333. 3     dsIllInstErr - illegal instruction error
  334. 4     dsZeroDivErr - zero divide error
  335. 5     dsChkErr - check trap error
  336. 6     dsOvflowErr - overflow trap error
  337. 7     dsPrivErr - privilege violation error
  338. 8     dsTraceErr - trace mode error
  339. 9     dsLineAErr - line 1010 trap error
  340. 10    dsLineFErr - line 1111 trap error
  341. 11    dsMiscErr - miscellaneous hardware exception error
  342. 12    dsCoreErr - unimplemented core routine error
  343. 13    dsIrqErr - uninstalled interrupt error
  344. 14    dsIOCoreErr - IO Core Error
  345. 15    dsLoadErr - Segment Loader Error
  346. 16    dsFPErr - Floating point error
  347. 17    dsNoPackErr - package 0 not present [List Manager]
  348. 18    dsNoPk1 - package 1 not present [Reserved by Apple]
  349. 19    dsNoPk2 - package 2 not present [Disk Initialization]
  350. 20    dsNoPk3 - package 3 not present [Standard File]
  351. 21    dsNoPk4 - package 4 not present [Floating-Point Arithmetic]
  352. 22    dsNoPk5 - package 5 not present [Transcendental Functions]
  353. 23    dsNoPk6 - package 6 not present [International Utilities]
  354. 24    dsNoPk7 - package 7 not present [Binary/Decimal Conversion]
  355. 25    dsMemFullErr - out of memory!
  356. 26    dsBadLaunch - can't launch file
  357. 27    dsFSErr - file system map has been trashed
  358. 28    dsStknHeap - stack has moved into application heap
  359. 30    dsReinsert - request user to reinsert off-line volume
  360. 31    dsNotThe1 - not the disk I wanted (obsolete)
  361. 33    negZcbFreeErr - ZcbFree has gone negative
  362. 40    dsGreeting - welcome to Macintosh greeting
  363. 41    dsFinderErr - can't load the Finder error
  364. 42    dsBadStartupDisk - unable to mount boot volume (obsolete)
  365. 43    dsSystemFileErr - canUt find System file to open (obsolete)
  366. 51    dsBadSlotInt - unserviceable slot interrupt
  367. 81    dsBadSANEopcode - bad opcode given to SANE Pack4
  368. 83    dsBadPatchHeader - SetTrapAddress saw the Rcome-fromS header
  369. 84    menuPrgErr - happens when a menu is purged
  370. 85    dsMBarNFnd - SysErr -- cannot find MBDF
  371. 86    dsHMenuFindErr - SysErr -- recursively defined HMenus
  372. 87    dsWDEFnFnd - Could not load WDEF
  373. 88    dsCDEFnFnd - Could not load CDEF
  374. 89    dsMDEFnFnd - Could not load MDEF
  375. 90    dsNoFPU - FPU instruction executed, but machine has no FPU
  376. 98    dsNoPatch - Can't patch for particular Model Mac
  377. 99    dsBadPatch - Can't load patch resource
  378. 101   dsParityErr - memory parity error
  379. 102   dsOldSystem - System is too old for this ROM
  380. 103   ds32BitMode - booting in 32-bit on a 24-bit sys
  381. 104   dsNeedToWriteBootBlocks - need to write new boot blocks
  382. 105   dsNotEnoughRAMToBoot - need at least 1.5MB of RAM to boot 7.0
  383. 20000 dsShutDownOrRestart - user choice between ShutDown and Restart
  384. 20001 dsSwitchOffOrRestart - user choice between Switch off or Restart
  385. 20002 dsForcedQuit - allow the user to ExitToShell, return if Cancel
  386.  
  387. ............
  388. ............
  389. ............
  390.  
  391. Mac TCP
  392. -23000 ipBadLapErr - Bad network configuration
  393. -23001 ipBadCnfgErr - Bad IP configuration error
  394. -23002 ipNoCnfgErr - Missing IP or LAP configuration error
  395. -23003 ipLoadErr - Error in MacTCP load
  396. -23004 ipBadAddr - Error in getting address
  397. -23005 connectionClosing - Connection in closing
  398. -23006 invalidLength
  399. -23007 connectionExists - Request conflicts with existing connection
  400. -23008 connectionDoesntExist - Connection does not exist
  401. -23009 insufficientResources - Insufficient rsrcs to perform request
  402. -23010 invalidStreamPtr
  403. -23011 streamAlreadyOpen
  404. -23012 connectionTerminated
  405. -23013 invalidBufPtr
  406. -23014 invalidRDS
  407. -23014 invalidWDS
  408. -23015 openFailed
  409. -23016 commandTimeout
  410. -23017 duplicateSocket
  411. -23030 ipOpenProtErr - Can't open new protocol, table full
  412. -23031 ipCloseProtErr - Can't find protocol to close
  413. -23032 ipDontFragErr - Packet too large to send w/o fragmenting
  414. -23033 ipDestDeadErr - Destination not responding
  415. -23034 ipBadWDSErr - Error in WDS format
  416. -23035 icmpEchoTimeoutErr - ICMP echo timed-out
  417. -23036 ipNoFragMemErr - No memory to send fragmented pkt
  418. -23037 ipRouteErr - Can't route packet off-net
  419. -23041 nameSyntaxErr
  420. -23042 cacheFault
  421. -23043 noResultProc
  422. -23044 noNameServer
  423. -23045 authNameErr
  424. -23046 noAnsErr
  425. -23047 dnrErr
  426. -23048 outOfMemory
  427.  
  428. Font Manager
  429. -32615 fontNotOutlineErr - bitmap passed, routine does outlines only
  430.  
  431. Primary or Secondary Init Code
  432. -32768 svTempDisable - Temporarily disable card but run primary init
  433. -32640 svDisabled - Reserve -32640 to -32768 for Apple temp disables
  434. /****************************************************************************/
  435.  
  436. You can find the whole thing in the resource fork of a convenient DA called
  437. SystemError.
  438. If you have trouble in getting this I could e-mail you personally
  439. this chain. Just ask for this...
  440. Enjoy "Error Strings".
  441.  
  442. --
  443. Jean-Marie LABORDE          laborde@imag.fr   or   UUCP:  imag!laborde
  444. 
  445. 
  446. Path: ucivax!gateway
  447. From: Jean-Marie.Laborde@imag.fr (Jean-Marie Laborde)
  448. Subject: Code for Error String (2)
  449. Message-ID: <199304050610.AA18353@isis.imag.fr>
  450. Newsgroups: fa.think-c
  451. Organization: IMAG Institute, University of Grenoble, France
  452. Lines: 137
  453. Date: 5 Apr 93 06:09:51 GMT
  454.  
  455. /*code of 3 functions, message(), FiltreDial() and extraction_texte_erreur(),
  456. needed to build the ErrorString feature, see other e-mail */
  457. /***************************************************************
  458. Copyright notice
  459. ) Jean-Marie Laborde LSD2-IMAG 1992-1993
  460. This code can be freely distributed and used, subject solely to the
  461. following conditions
  462.         % do not distribute changed or amended versions without prior
  463. agreement of the author.
  464.         % do not remove the present copyright notice
  465. This code is probably as any piece of code not absolutely bugfree and is
  466. not guaranteed in any manner.
  467.  
  468. This code was developed at the University of Grenoble (France) in connection
  469. with the project Cabri-gomtre.
  470. Cabri-gomtre is an integrated project for the design of ITS in the domain of
  471. Geometry.
  472. It is based on a microworld for Euclidian geometry called Cabri-gomtre and
  473. available from different distributors:
  474.         in the US contact
  475.                 Brooks/Cole Pacific Grove, California 93950    1-(800) 354
  476. 9706
  477.         outside the US contact
  478.                 Projet Cabri-gomtre, LSD2-IMAG        (33) 76 51 46 16
  479. (fax (33) 76 51 45 55)
  480. to obtain information about local distributors and publishers in other
  481. countries
  482.  
  483. Please send comments and/or suggestions to the following address
  484.         Jean-Marie Laborde
  485.         Cabri-gomtre project
  486.         LSD2-IMAG, Universit Joseph Fourier Grenoble
  487.         Centre National de la Recherche Scientifique
  488.         (33) 76 51 46 10    fax   (33) 76 51 45 55
  489.         laborde@imag.fr
  490.  
  491.  
  492. /***************************************************************
  493.  
  494. /*  % declare in your program a global myOSErr or any other suitable name  of
  495. type OSErr;
  496. the following #define makes the thing work */
  497. #define MONERREUR       myOSErr
  498.  
  499. /*      %% put the following prototype where needed:
  500.                         void    message(char *chaine,...);*/
  501.  
  502.  
  503. /*  %%% make calls in your program of general type
  504.                 message("%err ResError %d ResErr=%d",MONERREUR,ResErr);
  505.  
  506.                 -the simplest possible call is simply of type   message("any
  507. C-string");
  508.  
  509.         and then        message("");
  510.  
  511.                 -each time message() is called it checks if MONERREUR!=noErr
  512.                 as well as checking all the standard managers to detect any
  513.                 abnormal condition involving
  514.                                 the Resource Manager    (global ResErr
  515.  via ResError()),
  516.                                 the System
  517. (global DSErrCode   via SysError()),
  518.                                 the Memory Manager              (global MemErr
  519.         via MemError()),
  520.                                 the Print Manager               (global
  521. PrintErr        via PrError()).
  522.                 In such a case a dialog prompts with the corresponding error
  523. string(s) in a list
  524.                 with 3 buttons:
  525.                         % Resume                => resumes execution
  526.                         % ExitToShell   => just exits to shell
  527.                         % Debug                 => enters the Debugger (If the
  528. Think C Debugger is present
  529. we land in the code of the message() function, it is likely you will type
  530. 'command'-o)
  531.  
  532.                 If no abnormal condition, message() shows the string given as
  533. first argument CHAIN
  534.                 unless CHAIN starts with %err. In that case message() simply
  535. returns and
  536.                 the call is absolutely transparent to the user.
  537.  
  538.                 In addition, using a pattern close to formatted output, you
  539. can output values
  540. in the CHAIN taking advantage of the special character %:
  541. Suppose
  542.                         myOSErr has value 1  (Bus Error),
  543.                         long int longint has value 1234567890,
  544.                         char mychar has value 'a',
  545.                         long char lgchar has value 'APPL',
  546. then the following statement
  547.                         message("%err with context\nvalue of longint is %ld\n    value of mychar is %c\nvalue of lgchar is %lc",longint,mychar,lgchar);
  548. will produce following output:
  549.  
  550. _________________________________________________________
  551.                         |
  552.                                                         |
  553.                         |       Error MONERREUR: 1 (dsBusError - bus error)
  554.                 |
  555.                         |       with context
  556.                                         |
  557.                         |       value of longint is 1234567890
  558.                         |
  559.                         |           value of mychar is 'a'
  560.                                 |
  561.                         |       value of lgchar is 'APPL'
  562.                                 |
  563.                         |       __________              _________________
  564.         _________       |
  565.                         |       | Resume |              | ExitToShell() |
  566.         | Debug |       |
  567.                         |       __________              _________________
  568.         _________       |
  569.  
  570. _________________________________________________________ .
  571.  
  572. In CHAIN '\n' or '\r' works the same.
  573.  
  574. % when if %err, %ld, %d, %f, %s, %lc or %c      has following interpretation
  575.  
  576.                                 %err =>         makes the call transparent if
  577. noErr and CHAIN starts with %err
  578.                                 %ld                     output for a long int
  579.                                 %d                      output for a int
  580.                                 %f                      output for a float
  581. (ev. double)
  582.                                 %s                      output for a C-string
  583.                                 %lc                     output for a long to
  584. be printed as 'APPL'
  585.                                 %c                      output for a character
  586.                 (7(BEL) => \a,  8(BS) => \b,  9(HT) => \t, 10(LF) => \n,
  587.                  11(VT) => \v, 12(FF) => \f, 13(CR) => \r), 127 => '(dec 127)'
  588.  
  589.  
  590. --
  591. Jean-Marie LABORDE          laborde@imag.fr   or   UUCP:  imag!laborde
  592. 
  593. 
  594. Path: ucivax!gateway
  595. From: Jean-Marie.Laborde@imag.fr (Jean-Marie Laborde)
  596. Subject: Code for Error String (2)
  597. Message-ID: <199304050630.AA18976@isis.imag.fr>
  598. Newsgroups: fa.think-c
  599. Organization: IMAG Institute, University of Grenoble, France
  600. Lines: 121
  601. Date: 5 Apr 93 06:30:10 GMT
  602.  
  603. /*code of 3 functions, message(), FiltreDial() and extraction_texte_erreur(),
  604. needed to build the ErrorString feature, see other e-mail */
  605. /***************************************************************
  606. Copyright notice
  607. ) Jean-Marie Laborde LSD2-IMAG 1992-1993
  608. This code can be freely distributed and used, subject solely to the
  609. following conditions
  610.         % do not distribute changed or amended versions without prior
  611. agreement of the author.
  612.         % do not remove the present copyright notice
  613. This code is probably as any piece of code not absolutely bugfree and is
  614. not guaranteed in any manner.
  615.  
  616. This code was developed at the University of Grenoble (France) in connection
  617. with the project Cabri-gomtre.
  618. Cabri-gomtre is an integrated project for the design of ITS in the domain of
  619. Geometry.
  620. It is based on a microworld for Euclidian geometry called Cabri-gomtre and
  621. available from different distributors:
  622.         in the US contact
  623.                 Brooks/Cole Pacific Grove, California 93950    1-(800) 354
  624. 9706
  625.         outside the US contact
  626.                 Projet Cabri-gomtre, LSD2-IMAG        (33) 76 51 46 16
  627. (fax (33) 76 51 45 55)
  628. to obtain information about local distributors and publishers in other
  629. countries
  630.  
  631. Please send comments and/or suggestions to the following address
  632.         Jean-Marie Laborde
  633.         Cabri-gomtre project
  634.         LSD2-IMAG, Universit Joseph Fourier Grenoble
  635.         Centre National de la Recherche Scientifique
  636.         (33) 76 51 46 10    fax   (33) 76 51 45 55
  637.         laborde@imag.fr
  638.  
  639.  
  640. /***************************************************************
  641.  
  642. /*  % declare in your program a global myOSErr or any other suitable name  of
  643. type OSErr;
  644. the following #define makes the thing work */
  645. #define MONERREUR       myOSErr
  646.  
  647. /*      %% put the following prototype where needed:
  648.                         void    message(char *chaine,...);*/
  649.  
  650.  
  651. /*  %%% make calls in your program of general type
  652.                 message("%err ResError %d ResErr=%d",MONERREUR,ResErr);
  653.  
  654.                 -the simplest possible call is simply of type   message("any
  655. C-string");
  656.  
  657.         and then        message("");
  658.  
  659.                 -each time message() is called it checks if MONERREUR!=noErr
  660.                 as well as checking all the standard managers to detect any
  661.                 abnormal condition involving
  662.                                 the Resource Manager    (global ResErr
  663.  via ResError()),
  664.                                 the System
  665. (global DSErrCode   via SysError()),
  666.                                 the Memory Manager              (global MemErr
  667.         via MemError()),
  668.                                 the Print Manager               (global
  669. PrintErr        via PrError()).
  670.                 In such a case a dialog prompts with the corresponding error
  671. string(s) in a list
  672.                 with 3 buttons:
  673.                         % Resume                => resumes execution
  674.                         % ExitToShell   => just exits to shell
  675.                         % Debug                 => enters the Debugger (If the
  676. Think C Debugger is present
  677. we land in the code of the message() function, it is likely you will type
  678. 'command'-o)
  679.  
  680.                 If no abnormal condition, message() shows the string given as
  681. first argument CHAIN
  682.                 unless CHAIN starts with %err. In that case message() simply
  683. returns and
  684.                 the call is absolutely transparent to the user.
  685.  
  686.                 In addition, using a pattern close to formatted output, you
  687. can output values
  688. in the CHAIN taking advantage of the special character %:
  689. Suppose
  690.                         myOSErr has value 1  (Bus Error),
  691.                         long int longint has value 1234567890,
  692.                         char mychar has value 'a',
  693.                         long char lgchar has value 'APPL',
  694. then the following statement
  695.                         message("%err with context\nvalue of longint is %ld\n    value of mychar is %c\nvalue of lgchar is %lc",longint,mychar,lgchar);
  696. will produce following output:
  697.  
  698. _________________________________________________________
  699.                         |
  700.                                                         |
  701.                         |       Error MONERREUR: 1 (dsBusError - bus error)
  702.                 |
  703.                         |       with context
  704.                                         |
  705.                         |       value of longint is 1234567890
  706.                         |
  707.                         |           value of mychar is 'a'
  708.                                 |
  709.                         |       value of lgchar is 'APPL'
  710.                                 |
  711.                         |       __________              _________________
  712.         _________       |
  713.                         |       | Resume |              | ExitToShell() |
  714.         | Debug |       |
  715.                         |       __________              _________________
  716.         _________       |
  717.  
  718. _________________________________________________________ .
  719.  
  720. In CHAIN '\n' or '\r' works the same.
  721.  
  722. --
  723. Jean-Marie LABORDE          laborde@imag.fr   or   UUCP:  imag!laborde
  724. 
  725. 
  726. Path: ucivax!gateway
  727. From: Jean-Marie.Laborde@imag.fr (Jean-Marie Laborde)
  728. Subject: Code for Error String (2bis)
  729. Message-ID: <199304050633.AA19093@isis.imag.fr>
  730. Newsgroups: fa.think-c
  731. Organization: IMAG Institute, University of Grenoble, France
  732. Lines: 121
  733. Date: 5 Apr 93 06:33:22 GMT
  734.  
  735. /*code of 3 functions, message(), FiltreDial() and extraction_texte_erreur(),
  736. needed to build the ErrorString feature, see other e-mail */
  737. /***************************************************************
  738. Copyright notice
  739. ) Jean-Marie Laborde LSD2-IMAG 1992-1993
  740. This code can be freely distributed and used, subject solely to the
  741. following conditions
  742.         % do not distribute changed or amended versions without prior
  743. agreement of the author.
  744.         % do not remove the present copyright notice
  745. This code is probably as any piece of code not absolutely bugfree and is
  746. not guaranteed in any manner.
  747.  
  748. This code was developed at the University of Grenoble (France) in connection
  749. with the project Cabri-geometre.
  750. Cabri-geometre is an integrated project for the design of ITS in the domain of
  751. Geometry.
  752. It is based on a microworld for Euclidian geometry called Cabri-geometre and
  753. available from different distributors:
  754.         in the US contact
  755.                 Brooks/Cole Pacific Grove, California 93950    1-(800) 354
  756. 9706
  757.         outside the US contact
  758.                 Projet Cabri-geometre, LSD2-IMAG        (33) 76 51 46 16
  759. (fax (33) 76 51 45 55)
  760. to obtain information about local distributors and publishers in other
  761. countries
  762.  
  763. Please send comments and/or suggestions to the following address
  764.         Jean-Marie Laborde
  765.         Cabri-geometre project
  766.         LSD2-IMAG, Universit Joseph Fourier Grenoble
  767.         Centre National de la Recherche Scientifique
  768.         (33) 76 51 46 10    fax   (33) 76 51 45 55
  769.         laborde@imag.fr
  770.  
  771.  
  772. /***************************************************************
  773.  
  774. /*  % declare in your program a global myOSErr or any other suitable name  of
  775. type OSErr;
  776. the following #define makes the thing work */
  777. #define MONERREUR       myOSErr
  778.  
  779. /*      %% put the following prototype where needed:
  780.                         void    message(char *chaine,...);*/
  781.  
  782.  
  783. /*  %%% make calls in your program of general type
  784.                 message("%err ResError %d ResErr=%d",MONERREUR,ResErr);
  785.  
  786.                 -the simplest possible call is simply of type   message("any
  787. C-string");
  788.  
  789.         and then        message("");
  790.  
  791.                 -each time message() is called it checks if MONERREUR!=noErr
  792.                 as well as checking all the standard managers to detect any
  793.                 abnormal condition involving
  794.                                 the Resource Manager    (global ResErr
  795.  via ResError()),
  796.                                 the System
  797. (global DSErrCode   via SysError()),
  798.                                 the Memory Manager              (global MemErr
  799.         via MemError()),
  800.                                 the Print Manager               (global
  801. PrintErr        via PrError()).
  802.                 In such a case a dialog prompts with the corresponding error
  803. string(s) in a list
  804.                 with 3 buttons:
  805.                         % Resume                => resumes execution
  806.                         % ExitToShell   => just exits to shell
  807.                         % Debug                 => enters the Debugger (If the
  808. Think C Debugger is present
  809. we land in the code of the message() function, it is likely you will type
  810. 'command'-o)
  811.  
  812.                 If no abnormal condition, message() shows the string given as
  813. first argument CHAIN
  814.                 unless CHAIN starts with %err. In that case message() simply
  815. returns and
  816.                 the call is absolutely transparent to the user.
  817.  
  818.                 In addition, using a pattern close to formatted output, you
  819. can output values
  820. in the CHAIN taking advantage of the special character %:
  821. Suppose
  822.                         myOSErr has value 1  (Bus Error),
  823.                         long int longint has value 1234567890,
  824.                         char mychar has value 'a',
  825.                         long char lgchar has value 'APPL',
  826. then the following statement
  827.                         message("%err with context\nvalue of longint is %ld\n    value of mychar is %c\nvalue of lgchar is %lc",longint,mychar,lgchar);
  828. will produce following output:
  829.  
  830. _________________________________________________________
  831.                         |
  832.                                                         |
  833.                         |       Error MONERREUR: 1 (dsBusError - bus error)
  834.                 |
  835.                         |       with context
  836.                                         |
  837.                         |       value of longint is 1234567890
  838.                         |
  839.                         |           value of mychar is 'a'
  840.                                 |
  841.                         |       value of lgchar is 'APPL'
  842.                                 |
  843.                         |       __________              _________________
  844.         _________       |
  845.                         |       | Resume |              | ExitToShell() |
  846.         | Debug |       |
  847.                         |       __________              _________________
  848.         _________       |
  849.  
  850. _________________________________________________________ .
  851.  
  852. In CHAIN '\n' or '\r' works the same.
  853.  
  854. --
  855. Jean-Marie LABORDE          laborde@imag.fr   or   UUCP:  imag!laborde
  856. 
  857. 
  858. Path: ucivax!gateway
  859. From: Jean-Marie.Laborde@imag.fr (Jean-Marie Laborde)
  860. Subject: Code for Error String (3)
  861. Message-ID: <199304050701.AA20675@isis.imag.fr>
  862. Newsgroups: fa.think-c
  863. Organization: IMAG Institute, University of Grenoble, France
  864. Lines: 816
  865. Date: 5 Apr 93 07:00:40 GMT
  866.  
  867. This is a new hopefully better sending attempt
  868. (I am not in Grenoble but at the University of Washington (USA)
  869. and it does nor make the things easier...)
  870.  
  871. /*code of 3 functions, message(), FiltreDial() and extraction_texte_erreur(),
  872. needed to build the ErrorString feature, see other e-mail
  873.           (Use 4 char tab for better reading) */
  874. /***************************************************************
  875. Copyright notice
  876. Copyright Jean-Marie Laborde LSD2-IMAG 1992-1993
  877. This code can be freely distributed and used, subject solely to the
  878. following conditions
  879.         o do not distribute changed or amended versions without prior
  880. agreement of the author.
  881.         o do not remove the present copyright notice
  882. This code is probably as any piece of code not absolutely bugfree and is
  883. not guaranteed in any manner.
  884.  
  885. This code was developed at the University of Grenoble (France) in connection
  886. with the project Cabri-geometre.
  887. Cabri-geometre is an integrated project for the design of ITS in the domain of
  888. Geometry.
  889. It is based on a microworld for Euclidian geometry called Cabri-geometre and
  890. available from different distributors:
  891.         in the US contact
  892.                 Brooks/Cole Pacific Grove, California 93950    1-(800) 354
  893. 9706
  894.         outside the US contact
  895.                 Projet Cabri-geometre, LSD2-IMAG        (33) 76 51 46 16
  896. (fax (33) 76 51 45 55)
  897. to obtain information about local distributors and publishers in other
  898. countries
  899.  
  900. Please send comments and/or suggestions to the following address
  901.         Jean-Marie Laborde
  902.         Cabri-geometre project
  903.         LSD2-IMAG, Universite Joseph Fourier Grenoble
  904.         Centre National de la Recherche Scientifique
  905.         (33) 76 51 46 10    fax   (33) 76 51 45 55
  906.         laborde@imag.fr
  907.  
  908.  
  909. /***************************************************************
  910.  
  911. /*  o declare in your program a global myOSErr or any other suitable name  of
  912. type OSErr;
  913. the following #define makes the thing work */
  914. #define MONERREUR       myOSErr
  915.  
  916. /*      oo put the following prototype where needed:
  917.                         void    message(char *chaine,...);*/
  918.  
  919.  
  920. /*  ooo make calls in your program of general type
  921.                 message("%err ResError %d ResErr=%d",MONERREUR,ResErr);
  922.  
  923.                 -the simplest possible call is simply of type   message("any
  924. C-string");
  925.  
  926.         and then        message("");
  927.  
  928.                 -each time message() is called it checks if MONERREUR!=noErr
  929.                 as well as checking all the standard managers to detect any
  930.                 abnormal condition involving
  931.                                 the Resource Manager    (global ResErr
  932.  via ResError()),
  933.                                 the System
  934. (global DSErrCode   via SysError()),
  935.                                 the Memory Manager              (global MemErr
  936.         via MemError()),
  937.                                 the Print Manager               (global
  938. PrintErr        via PrError()).
  939.                 In such a case a dialog prompts with the corresponding error
  940. string(s) in a list
  941.                 with 3 buttons:
  942.                         o Resume                => resumes execution
  943.                         o ExitToShell   => just exits to shell
  944.                         o Debug                 => enters the Debugger (If the
  945. Think C Debugger is present
  946. we land in the code of the message() function, it is likely you will type
  947. 'command'-o)
  948.  
  949.                 If no abnormal condition, message() shows the string given as
  950. first argument CHAIN
  951.                 unless CHAIN starts with %err. In that case message() simply
  952. returns and
  953.                 the call is absolutely transparent to the user.
  954.  
  955.                 In addition, using a pattern close to formatted output, you
  956. can output values
  957. in the CHAIN taking advantage of the special character %:
  958. Suppose
  959.                         myOSErr has value 1  (Bus Error),
  960.                         long int longint has value 1234567890,
  961.                         char mychar has value 'a',
  962.                         long char lgchar has value 'APPL',
  963. then the following statement
  964.                         message("%err with context\nvalue of longint is %ld\n    value of mychar is %c\nvalue of lgchar is %lc",longint,mychar,lgchar);
  965. will produce following output:
  966.  
  967. _________________________________________________________
  968.                         |
  969.                                                         |
  970.                         |       Error MONERREUR: 1 (dsBusError - bus error)
  971.                 |
  972.                         |       with context
  973.                                         |
  974.                         |       value of longint is 1234567890
  975.                         |
  976.                         |           value of mychar is 'a'
  977.                                 |
  978.                         |       value of lgchar is 'APPL'
  979.                                 |
  980.                         |       __________              _________________
  981.         _________       |
  982.                         |       | Resume |              | ExitToShell() |
  983.         | Debug |       |
  984.                         |       __________              _________________
  985.         _________       |
  986.  
  987. _________________________________________________________ .
  988.  
  989. In CHAIN '\n' or '\r' works the same.
  990.  
  991. % when if %err, %ld, %d, %f, %s, %lc or %c      has following interpretation
  992.  
  993.                                 %err =>         makes the call transparent if
  994. noErr and CHAIN starts with %err
  995.                                 %ld                     output for a long int
  996.                                 %d                      output for a int
  997.                                 %f                      output for a float
  998. (ev. double)
  999.                                 %s                      output for a C-string
  1000.                                 %lc                     output for a long to
  1001. be printed as 'APPL'
  1002.                                 %c                      output for a character
  1003.                 (7(BEL) => \a,  8(BS) => \b,  9(HT) => \t, 10(LF) => \n,
  1004.                  11(VT) => \v, 12(FF) => \f, 13(CR) => \r), 127 => '(dec 127)'
  1005.  
  1006.                 characters >= 128 are printed, if possible, according the
  1007. following table
  1008.  
  1009.                 /* not ASCII 7 bitsASCII transferable
  1010.  */
  1011.  
  1012.  
  1013. */
  1014.  
  1015. /* oooo you should put the following initialisation of the system global
  1016. PrintErr=noErr;
  1017.         some where before the first call to message() or to the Print Manager
  1018.         because it seems that on most ROMs this global is initialised to -1
  1019. and not 0;
  1020.         an alternative way is to call   PrOpen();PrClose();
  1021.         after the 6 mandatory
  1022.                 InitGraf(&thePort);InitWindows();InitFonts();
  1023.                 InitDialogs(0L);InitCursor();TEInit();
  1024. */
  1025.  
  1026. /* ooooo this code needs resource from a separate file message.rsrc
  1027. to be searched at the same level as the project or the standalone application.
  1028. If this file cannot be found message() simply returns (with a beep if an error
  1029. is present).
  1030. Note that the project must contain MacTraps and ANSI
  1031. */
  1032.  
  1033.  
  1034. #include <MacHeaders>
  1035. #include <stdio.h>
  1036. #include <String.h>
  1037. #include <stdarg.h>
  1038.  
  1039. extern  OSErr   MONERREUR;
  1040.  
  1041. void    message         (char *chaine,...);
  1042. void    extraction_texte_erreur(OSErr monOSerreur,char *chaine,int pathRef,int
  1043. sv_pathRef);
  1044. Boolean pascal FiltreDial       (DialogPtr      Ledialogue,EventRecord
  1045. *Levent,int *Litem);
  1046. OSErr   Sonne           (char *leson);
  1047.  
  1048. static  Boolean erreur=FALSE;   /* permet de savoir si l'appel a sonne() vient
  1049. de message */
  1050.  
  1051. #define Item_duTEXTE    4
  1052.  
  1053.  
  1054.  
  1055. /**********************************************************************************************************************************/
  1056. void message(char *chaine, ...)
  1057. {
  1058.         int element;
  1059.         GrafPtr         sauveport;
  1060.         char            *carPtr;
  1061.         char            insertion[256+64];                      // une chaine
  1062. a inserer
  1063.         long            nbcar;
  1064.         DialogPtr       dialogue;
  1065.         int                     queltype;
  1066.         Rect            quelleboite;
  1067.         Handle          quelelement;
  1068.         int                     sauve_pathRefNum=CurResFile(),
  1069.                                 pathRefNum;
  1070.         TEHandle        texte_h=0;
  1071.         Boolean         rapporte_erreur=FALSE;
  1072.         OSErr           monResErr       =ResErr,
  1073.                                 monDSErrCode=DSErrCode,
  1074.                                 monMemErr       =MemErr,
  1075.                                 monPrintErr     =PrintErr;
  1076.  
  1077.  
  1078. // les globales d'erreur sont           ResErr,     DSErrCode,  MemErr,
  1079.  PrintErr
  1080. // les appels correspondants            ResError(), SysError(), MemError(),
  1081. PrError(),
  1082. // ATTENTION PrintErr est souvent -1 au demarrage d'une application...
  1083. // faire PrintErr=noErr dans les initialisations au debut du main
  1084.  
  1085. // on sauve les valeurs de ResErr, DSErrCode, monMemErr et PrintErr */
  1086.  
  1087. //////////////////////////////////////////////////////////////////////////////////
  1088.         if (*chaine=='%' && chaine[1]=='e' && chaine[2]=='r' && chaine[3]=='r'
  1089.                         &&
  1090.                 MONERREUR==noErr && !monResErr && !monDSErrCode && !monMemErr
  1091. && !monPrintErr)
  1092.                 return;
  1093. //////////////////////////////////////////////////////////////////////////////////
  1094.  
  1095.         pathRefNum=OpenResFile("\pmessage.rsrc");
  1096.         if (ResErr || pathRefNum==-1){          // en absence de message.rsrc
  1097. !!!!!
  1098.                 if (MONERREUR || monResErr || monDSErrCode || monMemErr ||
  1099. monPrintErr)
  1100.                         SysBeep(1);
  1101.                 //Debugger();
  1102.                 ResErr=0;  // in case of a subsequent call to message()
  1103.                 return;
  1104.         }
  1105.         UseResFile(pathRefNum);         // juste pour le cas ou message.rsrc
  1106. serait deja ouvert
  1107.         if (ResErr){
  1108.                 CloseResFile(pathRefNum);
  1109.                 SysBeep(1);
  1110.                 return;
  1111.         }
  1112.  
  1113.         dialogue=GetNewDialog(128,NULL,(WindowPtr) -1);
  1114.         UseResFile(sauve_pathRefNum);
  1115.         if (!dialogue) {
  1116.                 CloseResFile(pathRefNum);
  1117.                 SysBeep(1);
  1118.                 return;
  1119.         }
  1120.         GetPort(&sauveport);
  1121.         SetPort(dialogue);
  1122.  
  1123.         SetCursor(&arrow);
  1124.         GetDItem(dialogue,Item_duTEXTE,&queltype,&quelelement,&quelleboite);
  1125.         texte_h=TENew(&quelleboite,&quelleboite);
  1126. //(*texte_h)->txFont=times;
  1127.  
  1128.         if (carPtr=strchr(chaine,'%')){
  1129. /* la chaine necessite un traitement special, sinon trivial */
  1130. /* on fait une analyse de la chaine  T_C UserManual p 268 */
  1131. /* on devrait verifier le nbre de param == #car % !!! */
  1132.                         va_list suite_des_args;
  1133.                         long    longarg;
  1134.                         char    *chainearg, chararg;
  1135.                         int             intarg;
  1136.                         float   floatarg;
  1137.                         double  doublearg;
  1138.                         char    *sv_carPtr=&chaine[0],
  1139.                                         chaine_aux[256];        /* 256
  1140. intervient aussi dans extraction_texte_erreur */
  1141.  
  1142.                         erreur=FALSE;
  1143.                         va_start(suite_des_args,chaine);
  1144. /* chaine est le dernier argument nomme */
  1145.                         while (carPtr=strchr(carPtr,'%')){
  1146.                                 char    *insertPtr;
  1147.                                 int             nbcar;
  1148.  
  1149. /* remplacement des \n par des \r */
  1150.                                 strncpy((char
  1151. *)insertion,sv_carPtr,carPtr-sv_carPtr);
  1152.                                 for (nbcar=0;nbcar<carPtr-sv_carPtr;nbcar++)
  1153.                                         if (insertion[nbcar]=='\n')
  1154. insertion[nbcar]='\r';
  1155.  
  1156.                                 TEInsert((char
  1157. *)insertion,carPtr-sv_carPtr,texte_h);
  1158.  
  1159.                                 carPtr++;
  1160. /*****************/
  1161.                                 if (*carPtr=='e' && *(carPtr+1)=='r' &&
  1162. *(carPtr+2)=='r'){
  1163.                                         carPtr+=3;
  1164. // on ecrit le nom des variables d'erreur MONERREUR, ResErr, DSErrCode,
  1165. MemErr, PrintErr
  1166. // suivi du code et da signification
  1167. rap_erreur:
  1168.                                         if (MONERREUR){
  1169.                                                 insertPtr=&insertion[0];
  1170.                                                 strcpy(insertPtr,"\rError
  1171. MONERREUR: ");
  1172.                                                 insertPtr=strchr(insertPtr,0);
  1173.  
  1174.  
  1175. NumToString(MONERREUR,chaine_aux);
  1176.  
  1177. strncpy(insertPtr,chaine_aux+1,chaine_aux[0]);
  1178.                                                 insertPtr+=chaine_aux[0];
  1179.                                                 *insertPtr++='
  1180. ';*insertPtr++='('; /*)*/
  1181.  
  1182.  
  1183. extraction_texte_erreur(MONERREUR,chaine_aux,pathRefNum ,sauve_pathRefNum);
  1184.  
  1185. strncpy(insertPtr,chaine_aux+1,chaine_aux[0]);
  1186.                                                 insertPtr+=chaine_aux[0];
  1187.                                                 *insertPtr=0;
  1188.  
  1189.  
  1190. TEInsert(insertion,insertPtr-&insertion[0],texte_h);
  1191.                                                 /*(*/
  1192. TEInsert(")",1L,texte_h);
  1193.                                                 erreur=TRUE;
  1194.                                         }
  1195.                                         if (monResErr){
  1196.                                                 insertPtr=&insertion[0];
  1197.                                                 strcpy(insertPtr,"\rErreur
  1198. ResourceMgr ResErr: ");
  1199.                                                 insertPtr=strchr(insertPtr,0);
  1200.  
  1201.  
  1202. NumToString(monResErr,chaine_aux);
  1203.  
  1204. strncpy(insertPtr,chaine_aux+1,chaine_aux[0]);
  1205.                                                 insertPtr+=chaine_aux[0];
  1206.                                                 *insertPtr++='
  1207. ';*insertPtr++='('; /*)*/
  1208.  
  1209.  
  1210. extraction_texte_erreur(monResErr,chaine_aux,pathRefNum ,sauve_pathRefNum);
  1211.  
  1212. strncpy(insertPtr,chaine_aux+1,chaine_aux[0]);
  1213.                                                 insertPtr+=chaine_aux[0];
  1214.                                                 *insertPtr=0;
  1215.  
  1216.  
  1217. TEInsert(insertion,insertPtr-&insertion[0],texte_h);
  1218.                                                 /*(*/
  1219. TEInsert(")",1L,texte_h);
  1220.                                                 erreur=TRUE;
  1221.                                         }
  1222.                                         if (monDSErrCode){
  1223.                                                 insertPtr=&insertion[0];
  1224.                                                 strcpy(insertPtr,"\rErreur
  1225. Systeme DSErrCode: ");
  1226.                                                 insertPtr=strchr(insertPtr,0);
  1227.  
  1228.  
  1229. NumToString(monDSErrCode,chaine_aux);
  1230.  
  1231. strncpy(insertPtr,chaine_aux+1,chaine_aux[0]);
  1232.                                                 insertPtr+=chaine_aux[0];
  1233.                                                 *insertPtr++='
  1234. ';*insertPtr++='('; /*)*/
  1235.  
  1236.  
  1237. extraction_texte_erreur(monDSErrCode,chaine_aux,pathRefNum ,sauve_pathRefNum);
  1238.  
  1239. strncpy(insertPtr,chaine_aux+1,chaine_aux[0]);
  1240.                                                 insertPtr+=chaine_aux[0];
  1241.                                                 *insertPtr=0;
  1242.  
  1243.  
  1244. TEInsert(insertion,insertPtr-&insertion[0],texte_h);
  1245.                                                 /*(*/
  1246. TEInsert(")",1L,texte_h);
  1247.                                                 erreur=TRUE;
  1248.                                         }
  1249.                                         if (monMemErr){
  1250.                                                 insertPtr=&insertion[0];
  1251.                                                 strcpy(insertPtr,"\rErreur
  1252. MemoryMgr MemErr: ");
  1253.                                                 insertPtr=strchr(insertPtr,0);
  1254.  
  1255.  
  1256. NumToString(monMemErr,chaine_aux);
  1257.  
  1258. strncpy(insertPtr,chaine_aux+1,chaine_aux[0]);
  1259.                                                 insertPtr+=chaine_aux[0];
  1260.                                                 *insertPtr++='
  1261. ';*insertPtr++='('; /*)*/
  1262.  
  1263.  
  1264. extraction_texte_erreur(monMemErr,chaine_aux,pathRefNum ,sauve_pathRefNum);
  1265.  
  1266. strncpy(insertPtr,chaine_aux+1,chaine_aux[0]);
  1267.                                                 insertPtr+=chaine_aux[0];
  1268.                                                 *insertPtr=0;
  1269.  
  1270.  
  1271. TEInsert(insertion,insertPtr-&insertion[0],texte_h);
  1272.                                                 /*(*/
  1273. TEInsert(")",1L,texte_h);
  1274.                                                 erreur=TRUE;
  1275.                                         }
  1276.                                         if (monPrintErr){
  1277.                                                 insertPtr=&insertion[0];
  1278.                                                 strcpy(insertPtr,"\rErreur
  1279. PrintMgr PrintErr: ");
  1280.                                                 insertPtr=strchr(insertPtr,0);
  1281.  
  1282.  
  1283. NumToString(monPrintErr,chaine_aux);
  1284.  
  1285. strncpy(insertPtr,chaine_aux+1,chaine_aux[0]);
  1286.                                                 insertPtr+=chaine_aux[0];
  1287.                                                 *insertPtr++='
  1288. ';*insertPtr++='('; /*)*/
  1289.  
  1290.  
  1291. extraction_texte_erreur(monPrintErr,chaine_aux,pathRefNum ,sauve_pathRefNum);
  1292.  
  1293. strncpy(insertPtr,chaine_aux+1,chaine_aux[0]);
  1294.                                                 insertPtr+=chaine_aux[0];
  1295.                                                 *insertPtr=0;
  1296.  
  1297.  
  1298. TEInsert(insertion,insertPtr-&insertion[0],texte_h);
  1299.                                                 /*(*/
  1300. TEInsert(")",1L,texte_h);
  1301.                                                 erreur=TRUE;
  1302.                                         }
  1303.                                         if (!erreur){
  1304.                                                 strcpy((char
  1305. *)insertion,"\r(Apparemment pas d'erreur systeme)\r");
  1306.                                                 insertPtr=strchr((char
  1307. *)insertion,0);
  1308.  
  1309. TEInsert(insertion,insertPtr-&insertion[0],texte_h);
  1310.                                         }
  1311.                                         else{
  1312.                                                 TEInsert("\r",1L,texte_h);
  1313.                                         }
  1314. /* on mange en cas de milieu le premier blanc de la suite de la chaine */
  1315.                                         if (!rapporte_erreur){
  1316.                                                 if (*carPtr==' ') carPtr++;
  1317.                                         }
  1318.                                         sv_carPtr=carPtr;
  1319.                                         if (rapporte_erreur) goto
  1320. fin_rap_erreur;
  1321.                                         continue;
  1322.                                 }
  1323.                                 else if (*carPtr=='s'){
  1324.                                         chainearg=va_arg(suite_des_args,char
  1325. *);
  1326.                                         nbcar=strlen(chainearg);
  1327.                                         if (nbcar>255) chainearg[255]=0;
  1328.                                         strcpy((char *)insertion,chainearg);
  1329. /* mise de insertion entre " et " */
  1330.                                         CtoPstr((char *)insertion);
  1331.                                         nbcar=insertion[0]+1;
  1332.                                         insertion[0]='\"';
  1333.                                         if (nbcar<255-1){
  1334.                                                 insertion[nbcar++]='\"';
  1335.                                                 insertion[nbcar]=0;
  1336.                                         }
  1337.                                         else{
  1338.                                                 insertion[254]='\"';
  1339.                                                 insertion[255]=0;
  1340.                                         }
  1341.                                 }
  1342.                                 else if (*carPtr=='l' && *(carPtr+1)=='d'){
  1343.                                         longarg=va_arg(suite_des_args,long);
  1344.                                         carPtr++;
  1345.                                         NumToString(longarg,insertion);
  1346.                                         PtoCstr(insertion);
  1347.                                 }
  1348.                                 /*else if (*carPtr=='d' &&
  1349. *(carPtr+1)=='f'){*/
  1350. /*
  1351. doublearg=va_arg(suite_des_args,double);*/
  1352. /*                                      carPtr++;*/
  1353. /*                                      sprintf((char *)insertion,"%g",
  1354. doublearg);*/
  1355. /*                              }*/
  1356.                                 else if (*carPtr=='d'){
  1357.                                         intarg=va_arg(suite_des_args,int);
  1358.                                         NumToString((long)intarg,insertion);
  1359.                                         PtoCstr(insertion);
  1360.                                 }
  1361.                                 else if (*carPtr=='f'){
  1362.  
  1363. //floatarg=va_arg(suite_des_args,float);        // ne marche pas
  1364.  
  1365. //floatarg=va_arg(suite_des_args,double);
  1366.  
  1367. doublearg=va_arg(suite_des_args,double);
  1368.                                         sprintf((char *)insertion,"%g",
  1369. doublearg); // precision par defaut 6
  1370.                                 }
  1371.                                 else if (*carPtr=='l' && *(carPtr+1)=='c'){
  1372.                                         unsigned char c, nombre[4];
  1373. #include <ctype.h>
  1374. #define AFFICHE(car)    if (isprint(c) || (127<c && c<255))                { nombre[0]=c;nombre[1]=0;strcat((char *)insertion,(char
  1375. *)nombre);}                                                else{        switch(car){                case 0: strcat((char *)insertion,"\\0");break;                case 1: strcat((char *)insertion,"\\1");break;                case 2: strcat((char *)insertion,"\\2");break;                case 3: strcat((char *)insertion,"\\3");break;                case 4: strcat((char *)insertion,"\\4");break;                case 5: strcat((char *)insertion,"\\5");break;                case 6: strcat((char *)insertion,"\\6");break;                case 7: strcat((char *)insertion,"\\a");break;                case 8: strcat((char *)insertion,"\\b");break;                case 9: strcat((char *)insertion,"\\t");break;                case 10: strcat((char *)insertion,"\\n");break;                case 11: strcat((char *)insertion,"\\v");break;                case 12: strcat((char *)insertion,"\\f");break;                case 13: strcat((char *)insertion,"\\r");break;                default:                        NumToString((long)c
  1376.  
  1377. a
  1378.                         strcat((char *)insertion,"(dec ");                        strcat((char *)insertion,(char *)nombre);                        strcat((char *)insertion,")");break;}}
  1379.  
  1380.                                         longarg=va_arg(suite_des_args, long);
  1381.                                         carPtr++;
  1382.                                         insertion[0]=0;
  1383.  
  1384.                                         if (longarg/256==0){
  1385. /* en fait probablement un simple caractere */
  1386.                                                 c=longarg;
  1387.                                                 AFFICHE(c);
  1388.                                         }
  1389.                                         else{
  1390.                                                 c=longarg>>24;
  1391.                                                 AFFICHE(c);
  1392.                                                 longarg<<=8;
  1393.  
  1394.                                                 c=longarg>>24;
  1395.                                                 AFFICHE(c);
  1396.                                                 longarg<<=8;
  1397.  
  1398.                                                 c=longarg>>24;
  1399.                                                 AFFICHE(c);
  1400.                                                 longarg<<=8;
  1401.  
  1402.                                                 c=longarg>>24;
  1403.                                                 AFFICHE(c);
  1404.                                         }
  1405. /* mise de insertion entre ' et ' */
  1406.                                         CtoPstr((char *)insertion);
  1407.                                         nbcar=insertion[0]+1;
  1408.                                         insertion[0]='\'';
  1409.                                         insertion[nbcar++]='\'';
  1410.                                         insertion[nbcar]=0;
  1411.                                 }
  1412.                                 else if (*carPtr=='c'){
  1413.                                         unsigned char c, nombre[4];
  1414.                                         c=va_arg(suite_des_args, int);
  1415.                                         insertion[0]=0;
  1416.  
  1417.                                         AFFICHE(c);
  1418. /* mise de insertion entre ' et ' */
  1419.                                         CtoPstr((char *)insertion);
  1420.                                         nbcar=insertion[0]+1;
  1421.                                         insertion[0]='\'';
  1422.                                         insertion[nbcar++]='\'';
  1423.                                         insertion[nbcar]=0;
  1424.                                 }
  1425.                                 else{
  1426. /******************/
  1427. // % suivi de Type inconnu
  1428.                                         insertion[0]=' ';insertion[1]=0;
  1429.                                 }
  1430.                                 TEInsert(insertion,strlen(insertion),texte_h);
  1431.                                 sv_carPtr=++carPtr;
  1432.                         }
  1433.                         va_end(suite_des_args);
  1434. /* on insere la fin de la chaine avec echange de \n */
  1435.                         carPtr=strchr(sv_carPtr,0);
  1436.                         strncpy((char *)insertion,sv_carPtr,carPtr-sv_carPtr);
  1437.                         for (nbcar=0;nbcar<carPtr-sv_carPtr;nbcar++)
  1438.                                 if (insertion[nbcar]=='\n')
  1439. insertion[nbcar]='\r';
  1440.  
  1441.                         TEInsert((char *)insertion,carPtr-sv_carPtr,texte_h);
  1442.                 }
  1443.                 else{
  1444.                         strcpy((char *)insertion,chaine);
  1445.                         carPtr=&insertion[0];
  1446.                         while(*carPtr++)
  1447.                                 if (*carPtr=='\n') *carPtr='\r';
  1448.                         TESetText((char
  1449. *)insertion,strlen(insertion),texte_h);
  1450.                 }
  1451.  
  1452. /* pour  rapporter une erreursysteme meme sinon explicitement demande */
  1453. fin_rap_erreur:
  1454.         if (!rapporte_erreur && !erreur) {                      // ie au
  1455. premier passage
  1456.                 if (MONERREUR || monResErr || monDSErrCode || monMemErr ||
  1457. monPrintErr){
  1458.                         rapporte_erreur=TRUE;
  1459.                         TEInsert("\r",1L,texte_h);
  1460.                         goto rap_erreur;
  1461.                 }
  1462.         }
  1463.  
  1464.         {
  1465.                 int nbreLignes;
  1466. /* on compte le nombre de lignes */
  1467.                 TECalText(texte_h);
  1468.                 nbreLignes=(*texte_h)->nLines;
  1469.  
  1470.  
  1471.                 if (nbreLignes>1){
  1472.                         int
  1473. hauteur=((WindowPtr)dialogue)->portRect.bottom-((WindowPtr)dialogue)->portRect.top,
  1474.  
  1475. largeur=((WindowPtr)dialogue)->portRect.right-((WindowPtr)dialogue)->portRect.left,
  1476.                                 offset=(nbreLignes-1)*(*texte_h)->lineHeight;
  1477.  
  1478.                         SizeWindow(dialogue,largeur,hauteur+offset,FALSE);
  1479.  
  1480. /* on pourrait mettre un boucle de 1 a  (Item_duTEXTE-1) */
  1481.  
  1482.  
  1483. GetDItem(dialogue,OK,&queltype,&quelelement,&quelleboite);
  1484.                         OffsetRect(&quelleboite,0,offset);
  1485.  
  1486. SetDItem(dialogue,OK,queltype,quelelement,&quelleboite);
  1487.                         MoveControl(quelelement,quelleboite.left,
  1488. quelleboite.top);
  1489.  
  1490.  
  1491. GetDItem(dialogue,Cancel,&queltype,&quelelement,&quelleboite);
  1492.                         OffsetRect(&quelleboite,0,offset);
  1493.  
  1494. SetDItem(dialogue,Cancel,queltype,quelelement,&quelleboite);
  1495.                         MoveControl(quelelement,quelleboite.left,
  1496. quelleboite.top);
  1497.  
  1498.  
  1499. GetDItem(dialogue,Cancel+1,&queltype,&quelelement,&quelleboite);
  1500.                         OffsetRect(&quelleboite,0,offset);
  1501.  
  1502. SetDItem(dialogue,Cancel+1,queltype,quelelement,&quelleboite);
  1503.                         MoveControl(quelelement,quelleboite.left,
  1504. quelleboite.top);
  1505.  
  1506.                         (*texte_h)->destRect.bottom+=offset;
  1507.                         (*texte_h)->viewRect.bottom+=offset;
  1508.                 }
  1509. //On centre le dialogue;
  1510.                 {
  1511.                         int decal_h,decal_v;
  1512.                         Rect r;
  1513.                         r=screenBits.bounds;
  1514.                         decal_h=((r.right-r.left)
  1515.                                                 -
  1516.  
  1517. (dialogue->portRect.right-dialogue->portRect.left))/2
  1518.                                                         -
  1519.  
  1520. dialogue->portRect.left;
  1521.  
  1522.                         decal_v=(342            /* centrage vert. comme sur un
  1523. ecran de 9 pouces */
  1524.                                                 -
  1525.  
  1526. (dialogue->portRect.bottom-dialogue->portRect.top))/2
  1527.                                                 -
  1528.                                                 dialogue->portRect.top;
  1529.  
  1530.                         MoveWindow(dialogue,decal_h,decal_v,FALSE);
  1531.                 }
  1532.         }
  1533.         {
  1534.                 ProcPtr sauveMenuHook=MenuHook,
  1535.                                 sauveMBarHook=MBarHook;
  1536.  
  1537.                 MenuHook= NULL;
  1538.                 MBarHook= NULL;
  1539.  
  1540.                 ShowWindow(dialogue);
  1541.                 PenSize(3,3);
  1542.                 {
  1543.                         int no_item=OK;
  1544.                         if (erreur) no_item=Cancel;
  1545.  
  1546. GetDItem(dialogue,no_item,&queltype,&quelelement,&quelleboite);
  1547.                 }
  1548.                 InsetRect(&quelleboite,-4,-4);
  1549.                 FrameRoundRect(&quelleboite,16,16);PenNormal();
  1550.  
  1551.                 TEUpdate(&(*texte_h)->viewRect,texte_h);
  1552.                 DrawDialog(dialogue);
  1553.                 do {
  1554.                         ModalDialog(FiltreDial,&element);
  1555.                 }
  1556.                 while (element!=OK && element!=Cancel && element!=(Cancel+1));
  1557.                 SetPort(sauveport);
  1558.                 DisposDialog(dialogue);
  1559.  
  1560.                 MenuHook= sauveMenuHook;
  1561.                 MBarHook= sauveMBarHook;
  1562.  
  1563.                 TEDispose(texte_h);
  1564.                 UseResFile(sauve_pathRefNum);
  1565.                 CloseResFile(pathRefNum);
  1566.                 erreur=FALSE;
  1567.  
  1568.                 if (element==Cancel) ExitToShell();
  1569.                 if (element==Cancel+1) Debugger();
  1570. // dans le debugger de ThinkC faire maintenant "out" ...
  1571.         }
  1572. }
  1573.  
  1574. /******************************************************************/
  1575. Boolean pascal FiltreDial(DialogPtr Ledialogue,
  1576.                                                 EventRecord *Levent,
  1577.                                                 int             *Litem)
  1578. {
  1579.         char car;
  1580.         int type;
  1581.         Handle hit;
  1582.         Rect itr;
  1583.  
  1584.         if( (Levent->what==keyDown)){
  1585.                 car=Levent->message%256;
  1586.                 if (car=='\r' || car==3)
  1587.                 {
  1588.                         long finalTicks;
  1589.                         int     no_item=OK;
  1590.                         if (erreur) no_item=Cancel;
  1591.  
  1592.                         GetDItem(Ledialogue,no_item,&type,&hit,&itr);
  1593.                         HiliteControl(hit,1);
  1594.                         Delay(10L,&finalTicks);
  1595.                         *Litem=no_item;
  1596.                         return TRUE;
  1597.                 }
  1598.         }
  1599.         return FALSE;
  1600. }
  1601.  
  1602.  
  1603. /* on introduit le message d'erreur eventuel */
  1604. /*************************************************************************************/
  1605. void extraction_texte_erreur(OSErr monOSerreur,char *chaine,int pathRef,int
  1606. sv_pathRef)
  1607. /* renvoie une chaine Pascal dans chaine */
  1608. {
  1609.         Handle erreur_texte=0L;
  1610.         char    code_litteral[16];
  1611.         int             nbcar;
  1612.         long    taille;
  1613.         OSErr   sv_MemErr=MemErr,  // pour ne pas poluer MemErr
  1614.                         sv_ResErr=ResErr;
  1615.  
  1616.         char *textePtr, *carPtr, *finPtr;
  1617.         NumToString((long)monOSerreur,code_litteral);
  1618.         nbcar=code_litteral[0];
  1619.         code_litteral[0]='\r';
  1620.         code_litteral[nbcar+1]=' ';
  1621.         code_litteral[nbcar+2]=0;
  1622. /* on a entoure le nombre devenu chaine C (code_litteral) d'un RC et d'un ' '
  1623. */
  1624.  
  1625.         UseResFile(pathRef);
  1626.         erreur_texte=GetResource('TEXT',128);
  1627.         UseResFile(sv_pathRef);
  1628.         if (ResErr) {
  1629.                 ResErr=sv_ResErr;
  1630.                 strcpy((char *)chaine,"(ressource 'TEXT' id=128 non
  1631. disponible)");
  1632.                 PtoCstr((char *)chaine);
  1633.                 return;
  1634.         }
  1635.  
  1636.         {
  1637.                 taille=GetHandleSize(erreur_texte);
  1638.                 SetHandleSize(erreur_texte,taille+2L);
  1639.                 if (MemErr){
  1640.                         MemErr=sv_MemErr;
  1641.                         *(*erreur_texte+taille-1)=0;
  1642.                 }
  1643.                 else{
  1644.                         *(*erreur_texte+taille)='\r';
  1645.                         *(*erreur_texte+taille+1)=0;
  1646.                 }
  1647.                 HLock(erreur_texte);
  1648.                 textePtr=*erreur_texte;
  1649.                 carPtr=strstr(textePtr,(char *)code_litteral);
  1650.                 if (carPtr){
  1651. /* on avance sur les caracteres du code litteral */
  1652.                         carPtr+=nbcar+2;
  1653.                         while(*carPtr++==' ');
  1654.                         carPtr--;
  1655.                         finPtr=strchr(carPtr,'\r');
  1656.                         if (finPtr){
  1657.                                 *finPtr=0;
  1658.                                 nbcar=finPtr-carPtr;
  1659.                                 nbcar=(nbcar<255)?nbcar:255;
  1660.                                 strncpy((char *)chaine,carPtr,nbcar+1);
  1661.                                 *finPtr='\r';
  1662.                         }
  1663.                         else{  /* on a le dernier (obsolette depuis qu'on a
  1664. rajoute un '\r' et un 0) */
  1665.                                 nbcar=strlen(carPtr);
  1666.                                 nbcar=(nbcar<255)?nbcar:255;
  1667.                                 strncpy((char *)chaine,carPtr,nbcar+1);
  1668.                                 chaine[nbcar]=0;
  1669.                         }
  1670.                 }
  1671.                 else{
  1672. /* erreur non-referencee */
  1673.                         strcpy((char *)chaine,"not a referenced error!");
  1674.                 }
  1675.                 HUnlock(erreur_texte);
  1676.         }
  1677.         CtoPstr(chaine);
  1678. }
  1679. /**********************************************************************************************************************************/
  1680.  
  1681. --
  1682. Jean-Marie LABORDE          laborde@imag.fr   or   UUCP:  imag!laborde
  1683. 
  1684. 
  1685. Path: ucivax!gateway
  1686. From: wk02042@worldlink.com (PJ Vandal)
  1687. Subject: request Info about think class library
  1688. Message-ID: <9304050824.AA18669@worldlink.worldlink.com>
  1689. Newsgroups: fa.think-c
  1690. Lines: 26
  1691. Date: 5 Apr 93 08:22:44 GMT
  1692.  
  1693. I'm looking for a resource. I want to learn how to use the Think class
  1694. library with Think C.
  1695.  
  1696. I have verison 4.0. I've done some C programming in various environments,
  1697. including conventional (not object) on the mac. I have the Dave Mark books on
  1698. programming in C on the mac, and I've read the manual that comes with Think C
  1699. 4.0 several times. I've had several university (upper division) programming
  1700. classes in C and Pascal, and I understand the concept of object oriented
  1701. programming, but have very little actual experience doing oop.
  1702.  
  1703. I know a little bit about programming the mac, enough to cobble together
  1704. fairly simple applications. What I'd really like to find is information on
  1705. using the TCL that doesn't assume that I already know a lot about C++. I
  1706. guess I could read a book on C++, but if there were something out there that
  1707. would teach me what a general book on C++ would, but in the context of using
  1708. the Think class library instead, that would be really good.
  1709.  
  1710. I'm not a professional programmer, and won't do *that* much development. Is
  1711. it really worthwhile to get the 5.0 upgrade? Is there anything I should know
  1712. about using 4.0 if I don't?
  1713.  
  1714. Also, one of the main things that I'm interested in is user interface design,
  1715. particularly writing custom user interface elements (like custom windows and
  1716. buttons), so any information on learning about these things would be helpful
  1717. too.
  1718.  
  1719. 
  1720. 
  1721. Path: ucivax!gateway
  1722. From: dnebing@andy.bgsu.edu (Dave Nebinger)
  1723. Subject: ?? TESetText Fails ??
  1724. Message-ID: <9304062033.AA27165@andy.bgsu.edu>
  1725. Newsgroups: fa.think-c
  1726. Lines: 43
  1727. Date: 6 Apr 93 20:33:40 GMT
  1728. References: <mkentC4pnvD.EDK@netcom.com> <de19-040493171338@hjpatt-91.umd.edu>
  1729.  
  1730.   I have an appl that reads in a resource and uses the text in that
  1731. resource in a TE record.  Before the call to TESetText the handles are
  1732. locked down, and they are valid handles.  Using TC's debugger I have
  1733. looked at the data in the handle as well as the data in the TEHandle.
  1734.  
  1735.   In the following code, TESetText fails:
  1736.  
  1737. TextStyle style;
  1738. void * ptr;
  1739.  
  1740. style.tsFont=geneva;
  1741. style.tsSize=12;
  1742. style.tsFace=0;
  1743.  
  1744. HLock(gResOther);
  1745. HLock(TE_otherText);
  1746.  
  1747. i=GetHandleSize(gResOther);
  1748.  
  1749. TESetText(*gResOther,i,TE_otherText);
  1750.  
  1751. /*
  1752.   In the TE record, teLength & everything else is updated to show
  1753.   that some setting had occured.  But *(**TE_otherText).hText is a
  1754.   null string.
  1755. */
  1756.  
  1757. TESetSelect(0,32767,TE_otherText);
  1758.  
  1759. TESetStyle(doFont+doSize+doFace,&style,TRUE,TE_otherText);
  1760.  
  1761. TEActivate(TE_otherText);
  1762.  
  1763. HUnlock(TE_otherText);
  1764. HUnlock(gResOther);
  1765.  
  1766.  
  1767.  
  1768.   Why would TESetText fail?  I check TR 2.0, but it does not say that
  1769. TESetText could fail (or at least not do what it should)...  Any
  1770. assistance would be greatly appreciated.
  1771.  
  1772. dnebing@andy.bgsu.edu
  1773. 
  1774. 
  1775. Path: ucivax!gateway
  1776. From: siegel@world.std.com (Rich Siegel)
  1777. Subject: Re:  ?? TESetText Fails ??
  1778. Message-ID: <199304062235.AA05919@world.std.com>
  1779. Newsgroups: fa.think-c
  1780. Lines: 4
  1781. Date: 6 Apr 93 22:35:56 GMT
  1782.  
  1783. Don't lock the TEHandle; it's a variable-size data structure that needs to
  1784. grow. Locking the handle to your text -is- the correct thing to do, however.
  1785.  
  1786. R.
  1787. 
  1788. 
  1789. Path: ucivax!gateway
  1790. From: MRUHL@hermes.ece.arizona.edu ("The sky is ecstasy dancing...")
  1791. Subject: The Time Manager
  1792. Message-ID: <930408124434.276175b1@HERMES.ECE.ARIZONA.EDU>
  1793. Newsgroups: fa.think-c
  1794. Lines: 32
  1795. Date: 8 Apr 93 19:44:48 GMT
  1796. X-Vmsmail-To: SMTP%"think-c@ics.uci.edu"
  1797.  
  1798. I have been playing with the Time Manager, trying to discover how to use it.
  1799. One thing that I noticed, is that if you ever want to do a multiplication or
  1800. division of long ints, you must have the A5 register set to your application
  1801. A5.  If not, you will go into never never land.  Example, you set up your
  1802. routine to go off at a given time X.  When the routine is supposed to go off,
  1803. the OS apperently interupts the current process, and does the routine.  Since
  1804. it was an interupt the machine is currently using the OS A5.  When you try to
  1805. do a system call, the system does not return to the correct place, and dies.
  1806.  
  1807. After fighting with this (God I love MacsBug, it made solving this problem
  1808. feasable), I have come to the assumption, that the reason that this is
  1809. happening is that the long mult/division, are implemented as a subroutine of
  1810. the Mac OS.  Because of this, it apperently trys to jump back to the routine
  1811. that called it, instead of returning.  Since the A5 is pointing to the OS
  1812. globals instead of the application globals, it goes to the wrong place.  Can
  1813. anyone confirm or deny this?  I am going on conjecture, cause IM does not tell
  1814. me how the Time Manager works, it just tells me, sort of, how to use it.
  1815.  
  1816. Another problem that is occuring, is that I try to do a Get1Resource (or
  1817. something similar, I am trying to get a resource from the applications resource
  1818. file, not every open resource file around), and I don't get the resource that I
  1819. want.  If the above is correct, am I trying to get my resource from the OS
  1820. resource file, even thought the current application is mine?
  1821.  
  1822. Thanks,
  1823.    Mike
  1824.  
  1825. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  1826. mruhl@hermes.ece.arizona.edu        Loose cannon and programmer of Vaxes
  1827. ece_0263@bigdog.engr.arizona.edu    I don't work for anybody, so I don't
  1828. mruhl@alpha.sunquest.com        need a disclaimer.
  1829. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  1830. 
  1831. 
  1832. Path: ucivax!gateway
  1833. From: resnick@cogsci.uiuc.edu (Pete Resnick)
  1834. Subject: Re: The Time Manager
  1835. X-Sender: resnick@tarski.cogsci.uiuc.edu
  1836. Message-ID: <199304090857.AA02653@tarski.cogsci.uiuc.edu>
  1837. Newsgroups: fa.think-c
  1838. Lines: 43
  1839. Date: 9 Apr 93 08:57:21 GMT
  1840.  
  1841. At  7:44 PM 4/8/93 +0000, The sky is ecstasy dancing... wrote:
  1842.  
  1843. >One thing that I noticed, is that if you ever want to do a multiplication or
  1844. >division of long ints, you must have the A5 register set to your application
  1845. >A5.
  1846. >
  1847. >I have come to the assumption, that the reason that this is
  1848. >happening is that the long mult/division, are implemented as a subroutine of
  1849. >the Mac OS.
  1850.  
  1851. You were close, but you made the wrong diagnosis. It is true that the
  1852. touble you are having is in part due to A5 being wrong, but it is much
  1853. worse than you think. The long mult/div are not Mac OS, but THINK C glue
  1854. that is added to your program. The problem is that this glue obviously
  1855. ended up in a different segment from the one containing the Time Manager
  1856. task. In the best case, the long mult/div glue will be in a segment that is
  1857. loaded and locked at the time you need to call it; in that case, all you
  1858. need to do is set up A5, for which there are instructions in IM VI. In the
  1859. worst case, if the segment with the glue is not loaded, any attempt to load
  1860. the segment will crash the machine since you cannot call anything that will
  1861. cause the Memory Manager to kick in at interrupt time, and the Segment
  1862. Loader is a pretty bad offender. You cannot allocate or move memory at
  1863. interrupt, and the Segment Loader is sure to do that.
  1864.  
  1865. >Another problem that is occuring, is that I try to do a Get1Resource...
  1866.  
  1867. If you are trying to do this in the Time Manager task, it will most
  1868. certainly fail. Calling Get1Resource allocates memory for the resource and
  1869. hence cannot be called from interrupt.
  1870.  
  1871. Programming at interrupt is very limiting and is not for the faint of
  1872. heart. My recommendation is to have your Time Manager task set up A5, set a
  1873. global flag, and have your main event loop do what needs to be done. If you
  1874. have something that really needs to be done in a time sensitive way,
  1875. allocate and lock all memory before it will need to be called.
  1876.  
  1877. pr
  1878. --
  1879. Pete Resnick        (...so what is a mojo, and why would one be rising?)
  1880. Graduate assistant - Philosophy Department, Gregory Hall, UIUC
  1881. System manager - Cognitive Science Group, Beckman Institute, UIUC
  1882. Internet: resnick@cogsci.uiuc.edu
  1883.  
  1884. 
  1885. 
  1886. Path: ucivax!gateway
  1887. From: iron@imag.imag.fr (Francois Menneteau)
  1888. Subject: Re: The Time Manager
  1889. Message-ID: <199304091014.AA05965@isis.imag.fr>
  1890. In-Reply-To: "The sky is ecstasy dancing..."'s message as of Apr  8, 19:44.
  1891. Newsgroups: fa.think-c
  1892. Organization: IMAG Institute, University of Grenoble, France
  1893. Lines: 18
  1894. Date: 9 Apr 93 10:14:08 GMT
  1895.  
  1896. [8 Apr]. In your message you write:
  1897. >After fighting with this (God I love MacsBug, it made solving this problem
  1898. >feasable), I have come to the assumption, that the reason that this is
  1899. >happening is that the long mult/division, are implemented as a subroutine of
  1900. >the Mac OS.  Because of this, it apperently trys to jump back to the routine
  1901.  
  1902. Yes you are right. The 68000 is not able to do 32 bits multiplication (only
  1903. 16 bits x 16 bits with the result put in 16 or 32 bits is possible).
  1904.  
  1905. I can't remember if 68020 and higher family can, but I suppose either you
  1906. have a 68000 based machine, or the compiler does not use them (either because
  1907. you do not tell it [i.e. generate 68020 code] or because it can't).
  1908.  
  1909. --
  1910. Francois Menneteau ()   __|||||__   () "... I had their lives in my hands
  1911. ================== ()    /O   O\    () their fate their fortune in my visions
  1912. iron@imag.fr       ()    - .|. -    () No one believed in my true prophecy
  1913. ================== ()     \=^=/     () And now it's too late."  (Iron Maiden)
  1914. 
  1915. 
  1916. Path: ucivax!gateway
  1917. From: evans@natural.com (Christopher Evans)
  1918. Subject: Discipline
  1919. Message-ID: <9304131310.AA23560@natural.com>
  1920. Newsgroups: fa.think-c
  1921. Lines: 16
  1922. Date: 13 Apr 93 13:29:13 GMT
  1923.  
  1924.  
  1925.     What is wrong with Discipline?  I get a buss error whenever I
  1926. try to install it as an init in my System Folder.  Is there a problem
  1927. with System 7.1?
  1928.  
  1929. <==================================Q======================================>
  1930.   Chris Evans                      |   Internet: evans@natural.com
  1931.   Development                      |   Phone: 617-876-4876
  1932.   Natural Intelligence, Inc.       |   FAX:   617-492-7425
  1933.   2067 Massachusetts Avenue        |   AppleLink: NATURAL
  1934.   Cambridge MA  02140              |   or evans@natural.com@INTERNET#
  1935.  
  1936.  Vital papers will demonstrate their vitality by spontaneously moving
  1937.     from where you left them to where you can't find them.
  1938.  
  1939.  
  1940. 
  1941. 
  1942. Path: ucivax!gateway
  1943. From: C2MXBAR@fre.towson.edu (Aaron Barnett)
  1944. Subject: JADG
  1945. Message-ID: <01GWYPSVN1GY936BU3@TOE.TOWSON.EDU>
  1946. Content-transfer-encoding: 7BIT
  1947. MIME-version: 1.0
  1948. Newsgroups: fa.think-c
  1949. X-VMS-To: TOE::IN%"think-c@ics.uci.edu"
  1950. Lines: 1
  1951. Date: 13 Apr 93 17:55:29 GMT
  1952. X-Envelope-to: think-c@ics.uci.edu
  1953.  
  1954. where can I find JADG (afterdark glue)?
  1955. 
  1956. 
  1957. Path: ucivax!gateway
  1958. From: MRUHL@althea.ece.arizona.edu ("The sky is ecstasy dancing...")
  1959. Subject: Time Manager Summary
  1960. Message-ID: <930413132447.28600bc3@ALTHEA.ECE.ARIZONA.EDU>
  1961. Newsgroups: fa.think-c
  1962. Lines: 36
  1963. Date: 13 Apr 93 20:25:03 GMT
  1964. X-Vmsmail-To: SMTP%"think-c@ics.uci.edu"
  1965.  
  1966. I recently was playing with the Time Manager, and ran into a few problems.  I
  1967. documented them in an earlier message, but to sum up, when my routine was
  1968. activated at interupt time, some things would work sometimes, others would not
  1969. do anything, and still others would crash the computer.  Here is the answers I
  1970. recieved:
  1971.  
  1972.    Doing anything important during at interupt time is generally dangerous.  It
  1973. was suggested (1) that I set a flag, and have the main program notice that the
  1974. flag was set, and then do what I needed to do.
  1975.  
  1976.    My specific problem was that I was doing mult/div of long ints.  Think C
  1977. adds a special glue to do the mult/div.  This means that the segement with this
  1978. glue may or may not be loaded at the time it is needed.  Since you can do
  1979. anything that needs the Memory Manager at interrupt time, loading that segement
  1980. will cause problems.
  1981.  
  1982.    The above was also the problem with the Get1Resource call.  This calls the
  1983. Memory Manager as well, in order to allocate memory.
  1984.  
  1985.    One last suggestion, was to make sure that the compiler compiled with 68020
  1986. code instead of 68000.  I haven't had time to try this yet, but it could help
  1987. in getting rid of that special glue. :)
  1988.  
  1989. Thanks to:
  1990.  
  1991.  Pete Resnick
  1992.  Jens-Uwe Mager
  1993.  Francois Mennetau
  1994.  
  1995. Mike
  1996.  
  1997. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  1998. mruhl@hermes.ece.arizona.edu        Loose cannon and programmer of Vaxes
  1999. ece_0263@bigdog.engr.arizona.edu    I don't work for anybody, so I don't
  2000. mruhl@alpha.sunquest.com        need a disclaimer.
  2001. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  2002. 
  2003. 
  2004. Path: ucivax!gateway
  2005. From: zack@netcom.com ("Zack T. Smith")
  2006. Subject: After Dark
  2007. Message-ID: <9304132125.AA18744@netcom2.netcom.com>
  2008. Newsgroups: fa.think-c
  2009. Lines: 8
  2010. Date: 13 Apr 93 21:25:06 GMT
  2011.  
  2012.  
  2013. Has anyone got a description of how to code for After Dark that they could
  2014. send me?
  2015.  
  2016. Thanks in advance
  2017.  
  2018. Zack
  2019.  
  2020. 
  2021. 
  2022. Path: ucivax!gateway
  2023. From: P30WCC9%NIU.BITNET@uicvm.uic.edu (WES COVALT)
  2024. Subject: list clikLoop
  2025. Message-ID: <9304131548.aa05514@q2.ics.uci.edu>
  2026. Newsgroups: fa.think-c
  2027. Lines: 10
  2028. Date: 13 Apr 93 22:48:25 GMT
  2029.  
  2030. I need to tweak the list manager's clikLoop routine and I've
  2031. stumbled upon an interesting anomaly.  I am supposed to be
  2032. able to get the mouse location in the list from
  2033. (*myList)->mouseLoc, but I get wierd results.  For example, if
  2034. the local point is 4,4, I might get 140,20.
  2035.  
  2036. I'm so puzzled I don't even know what other information to give.
  2037. If anyone has worked on a list clikLoop, I'd appreciate some
  2038. suggestions.
  2039.                                    Wes
  2040. 
  2041. 
  2042. Path: ucivax!gateway
  2043. From: idowell@bbn.com
  2044. Subject: problem with sprintf?
  2045. Message-ID: <9304132145.aa07689@q2.ics.uci.edu>
  2046. Newsgroups: fa.think-c
  2047. Lines: 15
  2048. Date: 14 Apr 93 04:45:11 GMT
  2049.  
  2050. I'm using Think C 5.04.  Is there a known problem with
  2051. printing floats and long doubles or am I just being stupid?
  2052.  
  2053. #include <stdio.h>
  2054. char aString[256];
  2055. long double aNumber;
  2056.  
  2057. sprintf(aString,"%Lg",aNumber);
  2058.  
  2059. doesn't work at all (neither do %Le or %Lf, nor does %f with a float)
  2060. for me.
  2061.  
  2062. Thanks,
  2063. Ian Dowell
  2064. idowell@Bbn.com
  2065. 
  2066. 
  2067. Path: ucivax!gateway
  2068. From: jimlynch@netcom.com (Jim Lynch)
  2069. Subject: Re:  Time Manager Summary
  2070. Message-ID: <9304141319.AA28609@netcom2.netcom.com>
  2071. Newsgroups: fa.think-c
  2072. Lines: 10
  2073. Date: 14 Apr 93 13:19:26 GMT
  2074.  
  2075. I just _have_ to clean up one tiny detail:
  2076.  
  2077. Mike sed:
  2078. >>>>>
  2079. Since you can do
  2080. anything that needs the Memory Manager at interrupt time,
  2081. <<<<<
  2082.  
  2083. Must be a typo. should read: Since you can't do anything that needs the
  2084. Memory Manager at interrupt time,
  2085. 
  2086. 
  2087. Path: ucivax!gateway
  2088. From: MRUHL@hermes.ece.arizona.edu ("The sky is ecstasy dancing...")
  2089. Subject: Mistake
  2090. Message-ID: <930414085002.27618cd7@HERMES.ECE.ARIZONA.EDU>
  2091. Newsgroups: fa.think-c
  2092. Lines: 14
  2093. Date: 14 Apr 93 15:50:15 GMT
  2094. X-Vmsmail-To: SMTP%"think-c@ics.uci.edu"
  2095.  
  2096. Argh.
  2097.  
  2098. Thanks to Jim Lynch for catching my typo.  Yes that should have said:
  2099.  
  2100. "Should NOT" use memory management anything at interupt time.  Sorry about that
  2101. folks. :(
  2102.  
  2103. Mike
  2104.  
  2105. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  2106. mruhl@hermes.ece.arizona.edu        Loose cannon and programmer of Vaxes
  2107. ece_0263@bigdog.engr.arizona.edu    I don't work for anybody, so I don't
  2108. mruhl@alpha.sunquest.com        need a disclaimer.
  2109. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  2110. 
  2111. 
  2112. Path: ucivax!gateway
  2113. From: franklin@eecs.ucdavis.edu (Paul Franklin)
  2114. Subject: Re: Time Manager Summary
  2115. Message-ID: <9304142313.AA03129@burdock.eecs.ucdavis.edu>
  2116. In-Reply-To: Your message of "13 Apr 93 20:25:03 PST."
  2117.              <930413132447.28600bc3@ALTHEA.ECE.ARIZONA.EDU>
  2118. Newsgroups: fa.think-c
  2119. Reply-To: franklin@ece.ucdavis.edu
  2120. Lines: 15
  2121. Date: 14 Apr 93 23:13:29 GMT
  2122.  
  2123.  
  2124. Mike's message dated: 13 Apr 93 20:25:03 PST
  2125. >
  2126. >   My specific problem was that I was doing mult/div of long ints.
  2127. >Think C adds a special glue to do the mult/div.  This means that the
  2128. >segement with this glue may or may not be loaded at the time it is
  2129. >needed.  Since you can do anything that needs the Memory Manager at
  2130. >interrupt time, loading that segement will cause problems.
  2131.  
  2132. One way to solve this is to do a mult/div of long ints during
  2133. initialization, causing the glue to be loaded before the Time Manager
  2134. is ever called; thus, the glue is loaded at non-interrupt time but
  2135. used at interrupt time.
  2136.  
  2137. --Paul Franklin
  2138. 
  2139. 
  2140. Path: ucivax!gateway
  2141. From: rmf@chopin.cs.columbia.edu ("Robert M. Fuhrer")
  2142. Subject: Use Think C 5 to make MPW tools?
  2143. Message-ID: <9304150011.AA07655@chopin.cs.columbia.edu>
  2144. Newsgroups: fa.think-c
  2145. Reply-To: rmf@chopin.cs.columbia.edu
  2146. Lines: 11
  2147. Date: 15 Apr 93 00:11:17 GMT
  2148.  
  2149. Anyone know whether this is possible? Direct e-mail answers, please; I haven't
  2150. yet subscribed to the mailing list.
  2151.  
  2152. --------------------------
  2153. Robert M. Fuhrer
  2154. Computer Science Department
  2155. Columbia University
  2156. 503 CSC Building
  2157. (212) 939-7051
  2158.  
  2159. Internet: rmf@chopin.cs.columbia.edu
  2160. 
  2161. 
  2162. Path: ucivax!gateway
  2163. From: ingles@engin.umich.edu (Ray Ingles)
  2164. Subject: Why would a program run in the Debugger and not normally?
  2165. Message-ID: <5f57acba6.0033718@syndicoot.engin.umich.edu>
  2166. Newsgroups: fa.think-c
  2167. Lines: 17
  2168. Date: 15 Apr 93 07:41:12 GMT
  2169.  
  2170.  
  2171.  I'm using Think C 5.0.4 on a Mac Classic II (System 7, obviously). I have
  2172. all the optimizations off, and the "Think C + Objects" on. When I run my
  2173. program using the debugger, it works just fine. If I try to run it without
  2174. the debugger, or without a breakpoint set at one particular function, I
  2175. get a crash - it just exits.
  2176.  Note, I don't actually *do* anything at this breakpoint. I just go, then
  2177. it stops at the breakpoint, then I go again. If the breakpoint is off, I get
  2178. a 'bus error'.
  2179.  Now, obviously the debugger changes how the program is run. But does what
  2180. I'm describing offer any hint as to *what* is wrong?
  2181.  
  2182.  Sincerely,
  2183.  
  2184.  Raymond Ingles                       ingles@engin.umich.edu
  2185.  
  2186.  "An apple every eight hours keeps three doctors away." - B. Kliban
  2187. 
  2188. 
  2189. Path: ucivax!gateway
  2190. From: otto@igg.tno.nl
  2191. Subject: Get info
  2192. Message-ID: <9304150846.AA08580@igg_amethyst.igg.tno.nl>
  2193. Content-transfer-encoding: 7BIT
  2194. Newsgroups: fa.think-c
  2195. Lines: 2
  2196. X-Mts: smtp
  2197. Date: 15 Apr 93 09:47:55 GMT
  2198. X-Envelope-to: think-c@ics.uci.edu
  2199.  
  2200. help
  2201. dir
  2202. 
  2203. 
  2204. Path: ucivax!gateway
  2205. From: ahouse@hydra.rose.brandeis.edu (Jeremy John Ahouse)
  2206. Subject: Re: Why would a program run in the Debugger and not normally?
  2207. Message-ID: <9304151512.AA20371@hydra.rose.brandeis.edu>
  2208. Newsgroups: fa.think-c
  2209. Lines: 18
  2210. Date: 15 Apr 93 15:09:50 GMT
  2211.  
  2212. Raymond,
  2213. > Now, obviously the debugger changes how the program is run. But does what
  2214. >I'm describing offer any hint as to *what* is wrong?
  2215.  
  2216.         I don't know exactly what is happening with your program, but
  2217. frequently this kind of thing come from passing a pointer to a structure
  2218. that has not been defined in the current scope.  So there may be memory
  2219. available for it when you are running the debugger and you walk off into
  2220. disaster when the debugger is not on.  C doesn't check to see if the memory
  2221. that is pointed to is really reserved and full of what you claim it is
  2222. (e.g. a pointer to a Rect).
  2223.  
  2224.         So be sure that you are defining the datastructures in a local
  2225. scope (i.e. within the function) before you pass the addresses to functions
  2226. that will operate on that memory (eg SetRect).
  2227.  
  2228.         - Jeremy
  2229.  
  2230. 
  2231. 
  2232. Path: ucivax!gateway
  2233. From: ingles@engin.umich.edu (Ray Ingles)
  2234. Subject: Okay, *that's* why.
  2235. Message-ID: <5f5ac39a5.0033718@syndicoot.engin.umich.edu>
  2236. Newsgroups: fa.think-c
  2237. Lines: 38
  2238. Date: 15 Apr 93 20:44:29 GMT
  2239.  
  2240.  
  2241.  I have received a bunch of responses to my question about why a program
  2242. would run in the debugger and not directly. Thanks to:
  2243.  
  2244.  Lawrence K. Cormack
  2245.  Cheinan Marks
  2246.  J. Michael Morrison
  2247.  Gary Leydon
  2248.  Edward J. Huff
  2249.  TAIHOU
  2250.  
  2251.  I also received a couple requests to summarize responses. Possible causes
  2252. of problems like this include:
  2253.  
  2254.  1) Using pointers, handles, or arrays in bad ways. Trashing memory when
  2255.     you're in the debugger is not always fatal; it can just trash the
  2256.     debugger's memory and still limp through to the end. (This, by the way,
  2257.     was my problem. One *little* string, not allocated properly...)
  2258.  
  2259.  2) Failing to initialize the various managers and such. The debugger will
  2260.     often do this for you, so your program will run fine when in the debugger
  2261.     but not when you run it alone.
  2262.  
  2263.  3) You may have found a bug in the Mac OS or the debugger. Don't bet on it.
  2264.  
  2265.  (Note, Cheinan Marks suggested using SysBeep() calls to find out if code
  2266. was being executed rather than setting breakpoints. This way, you can find
  2267. out if it's your code, or a problem with how it interacts with the debugger.)
  2268.  
  2269.  Thanks again for the help! We're back on track, which is a good thing since
  2270. it's due Tuesday! :->
  2271.  
  2272.  Sincerely,
  2273.  
  2274.  Ray Ingles               ingles@engin.umich.edu
  2275.  
  2276.  "Icky icky icky icky fKANG zoop-boing n zowzyin..." -The Knights Who
  2277. So Recently Said "NEE!"
  2278. 
  2279. 
  2280. Path: ucivax!gateway
  2281. From: MRUHL@althea.ece.arizona.edu ("The sky is ecstasy dancing...")
  2282. Subject: garbaled return address.
  2283. Message-ID: <930415140017.28600c22@ALTHEA.ECE.ARIZONA.EDU>
  2284. Newsgroups: fa.think-c
  2285. Lines: 13
  2286. Date: 15 Apr 93 21:00:33 GMT
  2287. X-Vmsmail-To: SMTP%"think-c@ics.uci.edu"
  2288.  
  2289. Sorry to waste the bandwidth, but someone out there sent me a message, and
  2290. their return address was trashed, so I am sending to the regular list.
  2291.  
  2292. From what I could get, it was J. Wachs from JPMORGAN.COM.  Unfortunately,
  2293. everything I tried to send you bounced.  Please give me a return address.
  2294.  
  2295. Mike
  2296.  
  2297. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  2298. mruhl@hermes.ece.arizona.edu        Loose cannon and programmer of Vaxes
  2299. ece_0263@bigdog.engr.arizona.edu    I don't work for anybody, so I don't
  2300. mruhl@alpha.sunquest.com        need a disclaimer.
  2301. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  2302. 
  2303. 
  2304. Path: ucivax!gateway
  2305. From: idowell@bbn.com
  2306. Subject: sprintf answers
  2307. Message-ID: <9304151554.aa15884@q2.ics.uci.edu>
  2308. Newsgroups: fa.think-c
  2309. Lines: 82
  2310. Date: 15 Apr 93 22:54:40 GMT
  2311.  
  2312. Thanks to all who replied.  It turned out the problem was
  2313. that ANSI had been compiled with Universal floating point
  2314. and my project had been compiled with Native floating point.
  2315.  
  2316. Here are the answers I got...
  2317.  
  2318. ----------------------------------------------------
  2319. From: "Howard Rafal" <hrafal@BBN.COM>
  2320. It sounds like a pointer problem to me.  Think C is kind of flaky with
  2321. strings of the form [].  Just to be sure, I would try:
  2322.  
  2323.     (char *)&astring[0];
  2324.  
  2325. -----------------------------------------------------
  2326. From: zegers@amc.uva.nl
  2327.  
  2328. I think the problem is in the language settings of your compiler. When you
  2329. use routines from <stdio.h> they assume a general floating point point
  2330. format. There is a section about this in the user's manual.
  2331. Hope this helps.
  2332.  
  2333.  
  2334. --------------------------------------------------------------------------
  2335. From: bkirsch@NADC.NADC.NAVY.MIL (B. Kirsch)
  2336.  
  2337. Shouldn't you be using lower case L as:
  2338. sprintf(aString,"%lfg",aNumber);
  2339. ?
  2340.  
  2341. Barry Kirsch
  2342. bkirsch@nadc.navy.mil
  2343.  
  2344. ***** the manual says "L" but "l" probably works too
  2345.  
  2346. -----------------------------------------------------
  2347. From: bkirsch@NADC.NADC.NAVY.MIL (B. Kirsch)
  2348.  
  2349. sprintf(aString,"%lf",aNumber);
  2350. -----------------------------------------------------
  2351. From: "Kirk Crawford" <kirk_crawford@qmail2.aero.org>
  2352.  
  2353. #include <stdio.h>
  2354. Str255  aString;            /* Str255's are more common in Mac programs */
  2355.  
  2356. double aNumber;             /* you don't need the 'Long' type */
  2357.  
  2358. sprintf(aString,"%lg",aNumber);  /* the l should be lower case */
  2359. sprintf(aString,"%lf",aNumber);
  2360. sprintf(aString,"%le",aNumber);
  2361.  
  2362. -----------------------------------------------------
  2363. From: Jim Van Peursem <jvp@cpre1.ee.iastate.edu>
  2364.  
  2365.   Neither. Are you using ANSI-small? Open up this ANSI-small project
  2366. and look at the printf code. They #ifdef out the floating point
  2367. printing stuff. I made a copy of this project and #ifdef'd it back
  2368. in. Works great now!
  2369.  
  2370. -----------------------------------------------------
  2371. From: "Bin Zhang" <bzhang@BBN.COM>
  2372.  
  2373. I think the number may have to be the type of extended, otherwise
  2374. sprintf may not behave well ( but I am not a hundred percent sure).  You
  2375. could use one of the SANE functions: "num2str", which does a better job.
  2376. -----------------------------------------------------
  2377. From: swenson@john.berkeley.edu (Kirk Swenson)
  2378.  
  2379. Make sure that the ANSI library and your application are compiled with all
  2380. of the same settings, specifically the options relating to compilation of
  2381. floating point numbers.  You probably will have to recompile the ANSI
  2382. library, which is explained in the manual.
  2383.  
  2384. -----------------------------------------------------
  2385. From: "Kerry Shetline" <shetline@BBN.COM>
  2386.  
  2387. > sprintf(aString,"%Lg",aNumber);
  2388.  
  2389. I think you need a capital G.
  2390.  
  2391. ***** both "g" and "G" are valid and have slightly different
  2392.       behaviour
  2393. -----------------------------------------------------
  2394. 
  2395. 
  2396. Path: ucivax!gateway
  2397. From: nagel@ics.uci.edu (Mark Nagel)
  2398. Subject: ARCHIVE: CMIDI 2.1
  2399. Message-ID: <23596.734976960@ics.uci.edu>
  2400. Newsgroups: fa.think-c
  2401. Reply-To: think-c-request@ics.uci.edu
  2402. Lines: 18
  2403. Date: 16 Apr 93 16:16:14 GMT
  2404.  
  2405. Date: Wed, 14 Apr 1993 15:48:29 -0800
  2406. From: Paul Ferguson <pferguson@kaleida.com>
  2407. Subject: CMIDI 2.1 Submission
  2408.  
  2409. My CMIDI class library provides complete functionality for MIDI Manager
  2410. programming under TCL and is compatible with THINK C 5.0 and MIDI Manager
  2411. 1.2 and 2.0.  It includes a detailed programmer's reference manual, an
  2412. example program demonstrating its use, and complete source code.
  2413.  
  2414. -- fergy
  2415.  
  2416. ..........................................................................
  2417. Paul Ferguson                             Internet: pferguson@kaleida.com
  2418.   Kaleida Developer Services             AppleLink: kaleida.dev
  2419.   Kaleida Labs, Inc. (415) 966-0861     CompuServe: 70441,3055
  2420. ..........................................................................
  2421.  
  2422. [saved as: /mac/think-c/classes/cmidi-21.hqx; 256K]
  2423. 
  2424. 
  2425. Path: ucivax!gateway
  2426. From: bwilliam@cs.gmu.edu (Brian Williams)
  2427. Subject: Printing
  2428. Message-ID: <9304191825.AA11879@cs.gmu.edu>
  2429. Newsgroups: fa.think-c
  2430. Lines: 10
  2431. Date: 19 Apr 93 18:30:25 GMT
  2432.  
  2433.  
  2434. I am using TC 5.0 and need to print a file.   The file has been created
  2435. with ANSI file functions (fopen).  I would like to avoid using SFGetFile
  2436. to open the file for printing (The users will get a printout whether
  2437. they like it or not).
  2438.  
  2439. Any help would be appreciated.
  2440.  
  2441. Brian Williams
  2442. bwilliam@cs.gmu.edu
  2443. 
  2444. 
  2445. Path: ucivax!gateway
  2446. From: bradley@map.marc.usda.gov (Randy Bradley)
  2447. Subject: Re:  Printing
  2448. Message-ID: <9304201342.AA23675@map.marc.usda.gov>
  2449. Newsgroups: fa.think-c
  2450. Lines: 1
  2451. Date: 20 Apr 93 13:43:30 GMT
  2452.  
  2453.  
  2454. 
  2455. 
  2456. Path: ucivax!gateway
  2457. From: bradley@map.marc.usda.gov (Randy Bradley)
  2458. Subject: Re:  Printing
  2459. Message-ID: <9304201342.AA23672@map.marc.usda.gov>
  2460. Newsgroups: fa.think-c
  2461. Lines: 2
  2462. Date: 20 Apr 93 13:46:42 GMT
  2463.  
  2464. d
  2465. 
  2466. 
  2467. Path: ucivax!gateway
  2468. From: evans@natural.com (Christopher Evans)
  2469. Subject: Help wanted
  2470. Message-ID: <9304211401.AA08905@natural.com>
  2471. Newsgroups: fa.think-c
  2472. Lines: 26
  2473. Date: 21 Apr 93 14:29:51 GMT
  2474.  
  2475.  
  2476. MAC PROGRAMMERS IN THE NEW YORK AND BOSTON AREA:
  2477.  
  2478. Natural Intelligence, Inc. providers of a full range of computer
  2479. consulting services, has an immediate opening for a professional,
  2480. articulate Macintosh expert. We offer excellent pay, generous
  2481. benefits, and an attractive profit-sharing plan.
  2482.  
  2483. Natural Intelligence is a growing company with room for a highly
  2484. motivated individual. From the outset, this person must have the
  2485. skills, energy, and commitment to contribute to a team effort.
  2486.  
  2487. Candidates must have a strong working knowledge of many of the
  2488. following: 4th DIMENSION, MacToolbox, C, SQL, Sybase,
  2489. and/or Oracle.
  2490.  
  2491. Natural Intelligence is an equal opportunity employer.
  2492.  
  2493. Please send information to Natural Intelligence at:
  2494.  
  2495. e-mail: hr@natural.com
  2496. fax:    617 492-7425
  2497. usps:   2067 Massachusetts Avenue
  2498.         Cambridge, MA 02140
  2499.  
  2500.  
  2501. 
  2502. 
  2503. Path: ucivax!gateway
  2504. From: jonwd@palenque.uwtc.washington.edu (Jon Wiederspan)
  2505. Subject: C Pretty Printer
  2506. Message-ID: <9304220823.aa07688@q2.ics.uci.edu>
  2507. Newsgroups: fa.think-c
  2508. Lines: 8
  2509. Date: 22 Apr 93 15:23:46 GMT
  2510.  
  2511. Is there a "pretty printer" for C code on the Mac?  I have Think C 5.0x but I
  2512. didn't see one in the software.  Specifically, I'm looking for one that will
  2513. allow me to set the fonts & styles for code vs. comment vs. keyword and print
  2514. function banners.  I tried "PrettyC 1.43" by Jeremy somebody, but it quits
  2515. every time I try to open a file (System 7.1 with Japanese extensions).
  2516.  
  2517. Thanks!
  2518. Jon Wiederspan   jonwd@uwtc.washington.edu
  2519. 
  2520. 
  2521. Path: ucivax!gateway
  2522. From: wk02122@worldlink.com (Robert Story)
  2523. Subject: porting from unix
  2524. Message-ID: <9304230217.AA17121@worldlink.worldlink.com>
  2525. Newsgroups: fa.think-c
  2526. Lines: 15
  2527. Date: 23 Apr 93 02:16:10 GMT
  2528.  
  2529. is there a document somewhere that has hints/tips for porting other platforms
  2530. to the Mac?  I am trying to port GNU Zip with Think C 5.0.3.  I have the
  2531. compiler set to ANSI conformance, and 4 byte ints.  Right now, I am getting
  2532. errors on Mac includes.  ie, Memory.h gives me these errors :
  2533.  
  2534. - illegal type for variable
  2535. pascal Handle TempNewHandle(Size logicalSize,OSErr *resultCode)
  2536.     = {0x3F3C,0x001D,0xA88F};
  2537.  
  2538.  
  2539. - invalid declaration
  2540. typedef pascal long (*GrowZoneProcPtr)(Size cbNeeded);
  2541.  
  2542. rstory
  2543.  
  2544. 
  2545. 
  2546. Path: ucivax!gateway
  2547. From: siegel@world.std.com (Rich Siegel)
  2548. Subject: Re:  porting from unix
  2549. Message-ID: <199304230334.AA10085@world.std.com>
  2550. Newsgroups: fa.think-c
  2551. Lines: 9
  2552. Date: 23 Apr 93 03:41:06 GMT
  2553.  
  2554. The ANSI-conformant settings preclude use of Mac-specific (and non-
  2555. conformant) features such as 'pascal'-declared functions and inlines.
  2556. However, you can click the "ANSI" button, and then check the "THINK C"
  2557. extensions check box, and you'll be able to compile ANSI-conformant
  2558. programs and use the Mac interfaces for Mac-specific code.
  2559.  
  2560. BTW, 5.0.4 is the latest version.
  2561.  
  2562. R.
  2563. 
  2564. 
  2565. Path: ucivax!gateway
  2566. From: jimlynch@netcom.com (Jim Lynch)
  2567. Subject: Re:  porting from unix
  2568. Message-ID: <9304231121.AA16419@netcom2.netcom.com>
  2569. Newsgroups: fa.think-c
  2570. Lines: 1
  2571. Date: 23 Apr 93 11:21:57 GMT
  2572.  
  2573. The person to ask about anything GNU is rms@gnu.ai.mit.edu.
  2574. 
  2575. 
  2576. Path: ucivax!gateway
  2577. From: tim@maths.tcd.ie (Timothy Murphy)
  2578. Subject: Re: porting from unix
  2579. Message-ID: <9304231519.aa24103@salmon.maths.tcd.ie>
  2580. In-Reply-To: Robert Story's message of 23 Apr 93 02:16:10 GMT
  2581. Newsgroups: fa.think-c
  2582. Lines: 37
  2583. Date: 23 Apr 93 14:20:09 GMT
  2584.  
  2585. > is there a document somewhere that has hints/tips for porting other platforms
  2586. > to the Mac?  I am trying to port GNU Zip with Think C 5.0.3.  I have the
  2587. > compiler set to ANSI conformance, and 4 byte ints.  Right now, I am getting
  2588. > errors on Mac includes.  ie, Memory.h gives me these errors :
  2589. >
  2590. > - illegal type for variable
  2591. > pascal Handle TempNewHandle(Size logicalSize,OSErr *resultCode)
  2592. >     = {0x3F3C,0x001D,0xA88F};
  2593. >
  2594. >
  2595. > - invalid declaration
  2596. > typedef pascal long (*GrowZoneProcPtr)(Size cbNeeded);
  2597.  
  2598. I have compiled gzip using Think C without much difficulty.
  2599. The compiled program can be found at ftp.maths.tcd.ie
  2600. in pub/Mac/gzip.hqx .
  2601.  
  2602. The sources (or rather diffs from the official sources of gzip)
  2603. can be found in the directory /src/gnu/gzip-1.0.7/Mac .
  2604.  
  2605. I use a "Posix" library ThinkCPosix which contains some Unix functions
  2606. missing from the Think C library.
  2607. I will put this in pub/Mac/ThinkCPosix.
  2608.  
  2609. If un-gzipping text files gzipped on Unix,
  2610. you much give the switch '-a'.
  2611.  
  2612. I've been very impressed with both the compression and the speed of gzip.
  2613.  
  2614. Timothy Murphy
  2615.  
  2616. e-mail: tim@maths.tcd.ie
  2617. tel: +353-1-2842366 (home/office)
  2618.      +353-1-7021507 (university)
  2619. fax: +353-1-2842295
  2620. s-mail: School of Mathematics, Trinity College, Dublin 2, Ireland
  2621.  
  2622. 
  2623. 
  2624. Path: ucivax!gateway
  2625. From: jbcondat@attmail.com
  2626. Subject: Chaos Digest, #1.19
  2627. Message-ID: <9304240015.aa11161@q2.ics.uci.edu>
  2628. Content-Type: text
  2629. Newsgroups: fa.think-c
  2630. Lines: 541
  2631. Date: 24 Apr 93 07:15:22 GMT
  2632.  
  2633. Chaos Digest               Lundi 19 Avril 1993          Volume 1 : Numero 19
  2634.  
  2635.        Editeur: Jean-Bernard Condat (jbcondat@attmail.com)
  2636.        Archiviste: Yves-Marie Crabbe
  2637.        Co-Redacteurs: Arnaud Bigare, Stephane Briere
  2638.  
  2639. TABLE DES MATIERES, #1.19 (19 Avril 1993)
  2640. File 1--Alertes aux fausses factures d'annuaires France Telecom
  2641. File 2--Le "Clipper Chip": rapide descriptif
  2642. File 3--Slide presente a la Maison Blanche durant le briefing
  2643. File 4--Clipper Chip et le FBI (reprints)
  2644. File 5--Piratage France Telecom par un technicien France Telecom
  2645.  
  2646. Chaos Digest is a weekly electronic journal/newsletter. Subscriptions are
  2647. available at no cost by sending a message to:
  2648.                 linux-activists-request@niksula.hut.fi
  2649. with a mail header or first line containing the following informations:
  2650.                     X-Mn-Admin: join CHAOS_DIGEST
  2651.  
  2652. The editors may be contacted by voice (+33 1 47874083), fax (+33 1 47877070)
  2653. or S-mail at: Jean-Bernard Condat, Chaos Computer Club France [CCCF], B.P.
  2654. 155, 93404 St-Ouen Cedex, France.
  2655.  
  2656. Issues of ChaosD can also be found on some French BBS.  Back issues of
  2657. ChaosD can be found on the Internet as part of the Computer underground
  2658. Digest archives.  They're accessible using anonymous FTP from:
  2659.  
  2660.         * kragar.eff.org [192.88.144.4] in /pub/cud/chaos
  2661.         * uglymouse.css.itd.umich.edu [141.211.182.91] in /pub/CuD/chaos
  2662.         * halcyon.com [192.135.191.2] in /pub/mirror/cud/chaos
  2663.         * ftp.cic.net [192.131.22.2] in /e-serials/alphabetic/c/chaos-digest
  2664.         * ftp.ee.mu.oz.au [128.250.77.2] in /pub/text/CuD/chaos
  2665.         * nic.funet.fi [128.214.6.100] in /pub/doc/cud/chaos
  2666.         * orchid.csv.warwick.ac.uk [137.205.192.5] in /pub/cud/chaos
  2667.  
  2668. CHAOS DIGEST is an open forum dedicated to sharing French information among
  2669. computerists and to the presentation and debate of diverse views. ChaosD
  2670. material may be reprinted for non-profit as long as the source is cited.
  2671. Some authors do copyright their material, and they should be contacted for
  2672. reprint permission.  Readers are encouraged to submit reasoned articles in
  2673. French, English or German languages relating to computer culture and
  2674. telecommunications.  Articles are preferred to short responses.  Please
  2675. avoid quoting previous posts unless absolutely necessary.
  2676.  
  2677. DISCLAIMER: The views represented herein do not necessarily represent
  2678.             the views of the moderators. Chaos Digest contributors
  2679.             assume all responsibility for ensuring that articles
  2680.             submitted do not violate copyright protections.
  2681.  
  2682. ----------------------------------------------------------------------
  2683.  
  2684. Date: Thu Apr 15 11:47:00 +0200 1993
  2685. From: dufour_s@galaxie.int-evry.fr (Stephane DUFOUR )
  2686. Subject: File 1--Alertes aux fausses factures d'annuaires France Telecom
  2687.  
  2688.  
  2689.      Depuis plus de deux ans, des vagues de pseudo-factures imitant les
  2690. factures de France Telecom, se repandent sur le territoire national.  Ces
  2691. documents constituent une double tromperie:
  2692.  
  2693.      * Ils se presentent d'une part comme des factures, alors qu'ils ne
  2694. sont censes etre qu'une offre d'abonnement a un service d'annuaire pour la
  2695. telecopie, le telex ou le Minitel.  Cette presentation visiblement destinee
  2696. a abuser les consommateurs est penalement reprehensible et confine a la
  2697. tentative d'escroquerie.
  2698.  
  2699.      * Ils imitent d'autre part d'une facon plus ou moins manifeste les
  2700. factures emises par France Telecom, tant en ce qui concerne le nom du
  2701. service (France service Minitel, France Telecopie) que la presentation
  2702. generale, le logo ou la couleur a dominante bleue.  Ceci constitue aussi
  2703. une infraction de contrefacon ou imitation illicite.
  2704.  
  2705.      Des l'apparition de ces fraudes, France Telecom a reagi en portant
  2706. plainte chaque fois qu'une nouvelle affaire apparaissait.  Il a mis en garde
  2707. tous ses abonnes individuellement contre les risques de confusion.  Il est
  2708. intervenu sur ce sujet a de nombreuses reprises dans les medias et continue
  2709. de la faire.  Une collaboration etroite a ete etablie avec le parquet de
  2710. Paris qui centralise les plaintes et coordonne les differentes enquetes.
  2711.  
  2712.      France Telecom transmet en particulierles nouveaux "modeles" de factures
  2713. des qu'ils lui sont signales.  A titre d'exemple, cette cooperation entre
  2714. la justice, France Telecom et la Poste a permis en un an d'intercepter sur
  2715. commission rogatoire pres de 350 000 plis avant leur distribution et de
  2716. bloquer, en liaison avec les banques de nombreux cheques.
  2717.  
  2718.      L'instruction judiciaire a ete rendue plus difficile par le caractere
  2719. international de la fraude qui affecte une bonne partie de l'Europe et
  2720. utilise l'Autriche et le Lichtenstein comme plaques tournantes.  Toutefois
  2721. plusieurs personnes devraient etre traduites devant le tribunal correction-
  2722. nel d'ici cet ete.
  2723.  
  2724. ------------------------------
  2725.  
  2726. Date: Wed, 21 Apr 93 19:21:48 EDT
  2727. From: denning@cs.cosc.georgetown.edu (Dorothy Denning )
  2728. Subject: File 2--Le "Clipper Chip": rapide descriptif
  2729. Repost from: RISKS Digest
  2730.  
  2731.  
  2732.                      THE CLIPPER CHIP: A TECHNICAL SUMMARY
  2733.                                Dorothy Denning
  2734.                            Revised, April 21, 1993
  2735.  
  2736. INTRODUCTION
  2737.  
  2738. On April 16, the President announced a new initiative that will bring
  2739. together the Federal Government and industry in a voluntary program
  2740. to provide secure communications while meeting the legitimate needs of
  2741. law enforcement.  At the heart of the plan is a new tamper-proof encryption
  2742. chip called the "Clipper Chip" together with a split-key approach to
  2743. escrowing keys.  Two escrow agencies are used, and the key parts from
  2744. both are needed to reconstruct a key.
  2745.  
  2746.  
  2747. CHIP CONTENTS
  2748.  
  2749. The Clipper Chip contains a classified single-key 64-bit block
  2750. encryption algorithm called "Skipjack."  The algorithm uses 80 bit keys
  2751. (compared with 56 for the DES) and has 32 rounds of scrambling
  2752. (compared with 16 for the DES).  It supports all 4 DES modes of
  2753. operation.  The algorithm takes 32 clock ticks, and in Electronic
  2754. Codebook (ECB) mode runs at 12 Mbits per second.
  2755.  
  2756. Each chip includes the following components:
  2757.  
  2758.    the Skipjack encryption algorithm
  2759.    F, an 80-bit family key that is common to all chips
  2760.    N, a 30-bit serial number (this length is subject to change)
  2761.    U, an 80-bit secret key that unlocks all messages encrypted with the chip
  2762.  
  2763. The chips are programmed by Mykotronx, Inc., which calls them the
  2764. "MYK-78."  The silicon is supplied by VLSI Technology Inc.  They are
  2765. implemented in 1 micron technology and will initially sell for about
  2766. $30 each in quantities of 10,000 or more.  The price should drop as the
  2767. technology is shrunk to .8 micron.
  2768.  
  2769.  
  2770. ENCRYPTING WITH THE CHIP
  2771.  
  2772. To see how the chip is used, imagine that it is embedded in the AT&T
  2773. telephone security device (as it will be).  Suppose I call someone and
  2774. we both have such a device.  After pushing a button to start a secure
  2775. conversation, my security device will negotiate an 80-bit session key K
  2776. with the device at the other end.  This key negotiation takes place
  2777. without the Clipper Chip.  In general, any method of key exchange can
  2778. be used such as the Diffie-Hellman public-key distribution method.
  2779.  
  2780. Once the session key K is established, the Clipper Chip is used to
  2781. encrypt the conversation or message stream M (digitized voice).  The
  2782. telephone security device feeds K and M into the chip to produce two
  2783. values:
  2784.  
  2785.    E[M; K], the encrypted message stream, and
  2786.    E[E[K; U] + N; F], a law enforcement field ,
  2787.  
  2788. which are transmitted over the telephone line.  The law enforcement
  2789. field thus contains the session key K encrypted under the unit key U
  2790. concatenated with the serial number N, all encrypted under the family
  2791. key F.  The law enforcement field is decrypted by law enforcement after
  2792. an authorized wiretap has been installed.
  2793.  
  2794. The ciphertext E[M; K] is decrypted by the receiver's device using the
  2795. session key:
  2796.  
  2797.         D[E[M; K]; K] = M .
  2798.  
  2799.  
  2800. CHIP PROGRAMMING AND ESCROW
  2801.  
  2802. All Clipper Chips are programmed inside a SCIF (Secure Compartmented
  2803. Information Facility), which is essentially a vault.  The SCIF contains
  2804. a laptop computer and equipment to program the chips.  About 300 chips
  2805. are programmed during a single session.  The SCIF is located at
  2806. Mykotronx.
  2807.  
  2808. At the beginning of a session, a trusted agent from each of the two key
  2809. escrow agencies enters the vault.  Agent 1 enters a secret, random
  2810. 80-bit value S1 into the laptop and agent 2 enters a secret, random
  2811. 80-bit value S2. These random values serve as seeds to generate unit
  2812. keys for a sequence of serial numbers.  Thus, the unit keys are a
  2813. function of 160 secret, random bits, where each agent knows only 80.
  2814.  
  2815. To generate the unit key for a serial number N, the 30-bit value N is
  2816. first padded with a fixed 34-bit block to produce a 64-bit block N1.
  2817. S1 and S2 are then used as keys to triple-encrypt N1, producing a
  2818. 64-bit block R1:
  2819.  
  2820.         R1 = E[D[E[N1; S1]; S2]; S1] .
  2821.  
  2822. Similarly, N is padded with two other 34-bit blocks to produce N2 and
  2823. N3, and two additional 64-bit blocks R2 and R3 are computed:
  2824.  
  2825.         R2 = E[D[E[N2; S1]; S2]; S1]
  2826.         R3 = E[D[E[N3; S1]; S2]; S1] .
  2827.  
  2828. R1, R2, and R3 are then concatenated together, giving 192 bits. The
  2829. first 80 bits are assigned to U1 and the second 80 bits to U2.  The
  2830. rest are discarded.  The unit key U is the XOR of U1 and U2.  U1 and U2
  2831. are the key parts that are separately escrowed with the two escrow
  2832. agencies.
  2833.  
  2834. As a sequence of values for U1, U2, and U are generated, they are
  2835. written onto three separate floppy disks.  The first disk contains a
  2836. file for each serial number that contains the corresponding key part
  2837. U1.  The second disk is similar but contains the U2 values.  The third
  2838. disk contains the unit keys U.  Agent 1 takes the first disk and agent
  2839. 2 takes the second disk.  Thus each agent walks away knowing
  2840. an 80-bit seed and the 80-bit key parts.  However, the agent does not
  2841. know the other 80 bits used to generate the keys or the other 80-bit
  2842. key parts.
  2843.  
  2844. The third disk is used to program the chips.  After the chips are
  2845. programmed, all information is discarded from the vault and the agents
  2846. leave.  The laptop may be destroyed for additional assurance that no
  2847. information is left behind.
  2848.  
  2849. The protocol may be changed slightly so that four people are in the
  2850. room instead of two.  The first two would provide the seeds S1 and S2,
  2851. and the second two (the escrow agents) would take the disks back to
  2852. the escrow agencies.
  2853.  
  2854. The escrow agencies have as yet to be determined, but they will not
  2855. be the NSA, CIA, FBI, or any other law enforcement agency.  One or
  2856. both may be independent from the government.
  2857.  
  2858.  
  2859. LAW ENFORCEMENT USE
  2860.  
  2861. When law enforcement has been authorized to tap an encrypted line, they
  2862. will first take the warrant to the service provider in order to get
  2863. access to the communications line.  Let us assume that the tap is in
  2864. place and that they have determined that the line is encrypted with the
  2865. Clipper Chip.  The law enforcement field is first decrypted with the
  2866. family key F, giving E[K; U] + N.  Documentation certifying that a tap
  2867. has been authorized for the party associated with serial number N is
  2868. then sent (e.g., via secure FAX) to each of the key escrow agents, who
  2869. return (e.g., also via secure FAX) U1 and U2.  U1 and U2 are XORed
  2870. together to produce the unit key U, and E[K; U] is decrypted to get the
  2871. session key K.  Finally the message stream is decrypted.  All this will
  2872. be accomplished through a special black box decoder.
  2873.  
  2874.  
  2875. CAPSTONE: THE NEXT GENERATION
  2876.  
  2877. A successor to the Clipper Chip, called "Capstone" by the government
  2878. and "MYK-80" by Mykotronx, has already been developed.  It will include
  2879. the Skipjack algorithm, the Digital Signature Standard (DSS), the
  2880. Secure Hash Algorithm (SHA), a method of key exchange, a fast
  2881. exponentiator, and a randomizer.  A prototoype will be available for
  2882. testing on April 22, and the chips are expected to be ready for
  2883. delivery in June or July.
  2884.  
  2885.  
  2886. ACKNOWLEDGMENT AND DISTRIBUTION NOTICE
  2887.  
  2888. This article is based on information provided by NSA, NIST, FBI, and
  2889. Mykotronx.  Permission to distribute this document is granted.
  2890.  
  2891. ------------------------------
  2892.  
  2893. Date: Mon, 19 Apr 93 9:21:53 EDT
  2894. From: clipper@first.org (Clipper Chip Announcement )
  2895. Subject: File 3--Slide presente a la Maison Blanche durant le briefing
  2896.  
  2897. Note:     The following material was handed out a press briefing on the
  2898.           Clipper Chip on 4/16.
  2899.  
  2900.                         Chip Operation
  2901.  
  2902.                            Microchip
  2903. User's Message      +----------------------+
  2904. ------------------> |                      |      1.  Message encrypted
  2905.                     | Encryption Algorithm |          with user's key
  2906.                     |                      |
  2907.                     | Serial #             |      2.  User's key encrypted
  2908.                     |                      |-->       with chip unique key
  2909.                     | Chip Unique Key      |
  2910. User's Encryption   |                      |      3.  Serial # encrypted
  2911. Key                 | Chip Family Key      |          with chip family key
  2912. ------------------> |                      |
  2913.                     |                      |
  2914.                     +----------------------+
  2915.  
  2916.  
  2917.               For Law Enforcement to Read a Suspect's Message
  2918.  
  2919. 1. Need to obtain court authorized warrant to tap the suspect's telephone;
  2920.  
  2921. 2. Record encrypted message;
  2922.  
  2923. 3. Use chip family key to decrypt chip serial number;
  2924.  
  2925. 4. Take this serial number *and* court order to custodians of disks A and B;
  2926.  
  2927. 5. Add the A and B components for that serial number = the chip
  2928.    unique key for the suspect user;
  2929.  
  2930. 6. Use this key to decrypt the user's message key for
  2931.    this recorded message;
  2932.  
  2933. 7. Finally, use this message key to decrypt the recorded message.
  2934.  
  2935. ------------------------------
  2936.  
  2937. Date: Mon Apr 19 12:58:44 -0400 1993
  2938. From: prutkov@garnet.acns.fsu.edu (Paul Rutkovsky )
  2939. Subject: File 4--Clipper Chip et le FBI (reprints)
  2940. Copyrights: Warren Publishing, Inc. & San Jose Mercury News, 1993
  2941.  
  2942.  
  2943. GOVT. WEIGHS IN ON PRIVACY-VS.-ENCRYPTION DEBATE,  WITH ITS OWN TECHNOL OGY
  2944.  
  2945. Communications Daily   April 19, 1993   p. N/A
  2946. ISSN: 0277-0679
  2947.  
  2948.     Clinton   Administration   Fri.  announced  sweeping  policy  directive
  2949. designed   to  protect  privacy  of  voice  and  data  transmissions  using
  2950. govt.-developed encryption technology that ensures law enforcement agencies
  2951. will  have  ability  to  eavesdrop.  Encyrption is  achieved through use of
  2952. "Clipper    Chip  "  that  will  be  built  into telephones, computers, fax
  2953. machines.  Although  govt.  will  adopt  new  chip  as its standard, use in
  2954. private sector will be on voluntary basis.
  2955.  
  2956.     AT&T  Fri.  became  first  company  to  announce  publicly  support  of
  2957.  Clipper    Chip  .  "We  believe  it  will  give our customers far greater
  2958. protection in defeating hackers or eavesdroppers in attempting to intercept
  2959. a  call,"  said  AT&T Vp Secure Communications Systems Edward Hickey. Govt.
  2960. already has purchased some evaluation units from AT&T with  Clipper   Chip
  2961. installed,  said  Raymond  Kramer,  acting  dir.  of  National Institute of
  2962. Standards  &  Technology  (NIST).  Govt. expects to purchase "well over the
  2963. thousands"  of  such   Clipper   Chip  units, he said, but he couldn't give
  2964. figures  for  how many it might buy from AT&T. AT&T spokesman said products
  2965. with   Clipper    Chip   included  will  be  available  commercially in 2nd
  2966. quarter.
  2967.  
  2968.     President  Clinton Thurs. signed Top Secret National Security Directive
  2969. outlining  details  of  privacy  and  encryption policy review. Review will
  2970. bring  together  industry  and  govt.  experts  under direction of National
  2971. Security Council in attempt to resolve long-running controversy on right of
  2972. businesses  and  citizens  to  protect all forms of communication and govt.
  2973. right to conduct lawful investigations. Review will take 3-4 months, NIST's
  2974. Kramer said.
  2975.  
  2976.     Law  enforcement  agencies  are  concerned  about  rising popularity of
  2977. digital   encryption   methods.  Multinational  businesses,  worried  about
  2978. economic  espionage,  increasingly  are incorporating encryption technology
  2979. for  all  communications.  Law  enforcement  agencies  have  voiced growing
  2980. concern  that if they don't move quickly to enact laws assuring them access
  2981. to   encrypted   and  digital  communications,  they  will  be  at  decided
  2982. disadvantage in attempting to thwart  criminal acts.   FBI  spokesman James
  2983. Kallstrom acknowledged that "not many" criminals today are using encryption
  2984. to  skirt  law,  but  putting  methods  in  place  now  to  assure means of
  2985. intercepting such communications "is vital" to law enforcement's mission.
  2986.  
  2987.     Encryption  program  will  be  available  to  any  vendor that wants to
  2988. manufacture  chips,  Kramer  said.  However,  company  that  developed  and
  2989. designed  chip  under  sole-source  contract  from National Security Agency
  2990. (NSA)  --  Mykotronx,  Torrance,  Cal.  -- has solid lead on market. Kramer
  2991. acknowledged   job   was   handed   to  it  with  NSA's  full  approval  of
  2992. noncompetitive  bid  contract.  He defended noncompetition aspect: "We went
  2993. out  and  found the only company capable of delivering this technology." He
  2994. said  govt.  has been using  Clipper   Chip  technology for "a while now in
  2995. classified  applications,"  but declined to say how long it had been in use
  2996. before  White   House  announcement.
  2997.  
  2998.     Each  chip will have 3 unique "keys" issued to it. When manufactured, 2
  2999. of  those  keys  will be sent to govt. and will be held by "escrow agents."
  3000. For  law  enforcement  agency to be able descramble transmissions, it first
  3001. must  get  court order that allows keys held in escrow to be released. Only
  3002. when  those keys are used in tandem can law enforcement agencies unscramble
  3003. codes and listen in on conversations. Attorney Gen.'s office will "make all
  3004. arrangements with appropriate entities to hold keys,"  White   House  said.
  3005. Those escrow keys could be held by private organizations, govt. agencies or
  3006. others,  Kramer  said.  But  only  2  entities  will  be chosen and will be
  3007. responsible  for  administering  data  base  that will store keys. Attorney
  3008. Gen.'s  office is expected to select escrow key holders "within a couple of
  3009. weeks," Kramer said.
  3010.  
  3011.     Plan  already  is  drawing fire from civil liberties groups and privacy
  3012. advocates.  Electronic Frontier Foundation (EFF) said  White   House  acted
  3013. "before  any  public  comment  or  discussion  has  been  allowed." It said
  3014. Administration  will  use  "its  leverage  to  get  all telephone equipment
  3015. vendors  to adopt" technology. EFF criticized govt.'s sole-source contract,
  3016. saying there may be other companies that have better encryption technology,
  3017. and  because  encryption  algorithm is classified, it can't be tested. "The
  3018. public will only have confidence in the security of a standard that is open
  3019. to  independent,  expert scrutiny," EFF said. Privacy experts are concerned
  3020. that  because   Clipper    Chip  was developed under NSA contract, it might
  3021. have "backdoor" known only to NSA that would allow agency to crack code and
  3022. bypass  court  order. Kramer disagreed: "There is positively no backdoor to
  3023. this technology."
  3024.  
  3025.     Because  use  of  Clipper   Chip  is entirely voluntary, businesses and
  3026. private  users  -- including criminals -- are free to choose other means of
  3027. encryption,  leaving  govt.  and law enforcement agencies with dilemma they
  3028. now  face.    FBI  's  Kallstrom  acknowledged criminals still could thwart
  3029. investigations  if  they  used  non- Clipper    Chip   products,  "but most
  3030. criminals aren't so smart."
  3031.  
  3032.     Ability  of  govt.   to  eavesdrop on  Clipper   Chip -equipped devices
  3033. still  doesn't  solve  broader  problem:  Ability  to wiretap conversations
  3034. moving  across  digital  telecommunications  lines.  That  problem is being
  3035. addressed  separately  by  FBI 's controversial digital wiretap legislation
  3036. that has failed to find congressional sponsor and is languishing in Justice
  3037. Dept., waiting for support of Attorney Gen.
  3038.  
  3039. +++++
  3040.  
  3041. U.S. SCHEME TO EAVESDROP ELECTRONICALLY RAISES CONCERNS CIVIL LIBERTARIANS,
  3042. INDUSTRY GROUP WANT PUBLIC INPUT INTO 'KEY' PLAN
  3043. San Jose Mercury News (SJ) - Saturday, April 17, 1993
  3044. By: RORY J. O'CONNOR, Mercury News Staff Writer
  3045. Edition: Morning Final  Section: Business  Page: 11D
  3046.  
  3047. Civil  libertarians  and  a  major  computer industry group raised concerns
  3048. Friday about how much protection a Clinton administration plan would afford
  3049. private   electronic  communications,  from  cellular  telephone  calls  to
  3050. computer data.
  3051.  
  3052.   The  administration Friday said it would begin using technology developed
  3053. by  the  government's  National  Institute  of  Standards and Technology to
  3054. balance  two  competing  interests:  the  desire  of citizens to keep their
  3055. conversations  private and the need for law enforcement agencies to monitor
  3056. those conversations after getting a court order.
  3057.  
  3058. The  technology  that   enables this is a computer chip called the  Clipper
  3059. Chip   that  scrambles a  telephone call or computer message using a secret
  3060. algorithm, or formula.
  3061.  
  3062.   But  each  chip also comes with a pair of electronic "keys" that could be
  3063. used  by law enforcement agencies to decipher the secret messages generated
  3064. by the chip.
  3065.  
  3066.   The Clinton proposal calls for one key to be held by each of two separate
  3067. "trusted" third parties, who would release them to law enforcement agencies
  3068. that  obtained  legal  authority to intercept the communications. Both keys
  3069. would be needed to decipher a message.
  3070.  
  3071.   The  Electronic  Frontier  Foundation,  a  not-for-profit civil liberties
  3072. group,  praised  the  administration  for  considering  the  issue.  But it
  3073. criticized the lack of public input into the plan.
  3074.  
  3075.   "They've announced a big inquiry with public input, but they've reached a
  3076. conclusion before they started," said Daniel J. Weitzner, staff counsel for
  3077. the Washington-based foundation.
  3078.  
  3079.   Although  the  administration's  plan calls only for equipping government
  3080. telephones  with  the  security devices, some groups are concerned the plan
  3081. might  become  a standard for all manner of electronic communication before
  3082. the public has a chance to debate its merits.
  3083.  
  3084.   "I  don't  want to sound too stridently opposed to this," said Ken Wasch,
  3085. executive   director  of  the  Software  Publishers  Association  (SPA)  in
  3086. Washington. "But... we feel blindsided."
  3087.  
  3088.   The  SPA  was discussing data security issues with Clinton administration
  3089. officials  but  had  not  expected any  White   House  action until August,
  3090. said Ilene Rosenthal, general counsel.
  3091.  
  3092.   Besides the lack of initial hearings, both groups said they had two major
  3093. concerns about the Clinton plan:
  3094.  
  3095.   (box)  Because  the  algorithm  itself  is  secret,  the groups say it is
  3096. impossible  for the public to discern if it is truly secure. Users can't be
  3097. certain  government  spy  agencies  have  not  hidden  a "back door" in the
  3098. software that will allow them to read anything they want.
  3099.  
  3100.   "So  far there hasn't been a credible explanation about why the algorithm
  3101. has to be secret," Weitzner said.
  3102.  
  3103.   (box)  The  administration  hasn't decided who will be the escrow agents,
  3104. and  it  seems  unlikely  any  government agency, corporate entity or other
  3105. organization would be deemed trustworthy by every user.
  3106.  
  3107.   Even  assuming  all  concerned  can  agree  on  who will hold them, civil
  3108. libertarians  are  concerned  that  the  keys,  by  giving  law enforcement
  3109. agencies access to individuals' private communications, might pose a threat
  3110. to constitutional protections against self-incrimination.
  3111.  
  3112.    Washington sources who requested anonymity suggested the  White    House
  3113. might  have  drafted  its  plan quickly because of concern over sales of an
  3114. AT&T  device  that  encrypts  phone  calls  using  an  older standard, Data
  3115. Encryption  Standard. The sources said law enforcement officials feared the
  3116. device  would  create  an explosion in secured telephone traffic that would
  3117. severely hamper their efforts to wiretap calls.
  3118.  
  3119.   American Telephone & Telegraph announced Friday it would adapt the $1,200
  3120. product,  called the Telephone Security Device, to use the  Clipper    Chip
  3121. by  the  end  of  this  fiscal  quarter. AT&T makes a related device, which
  3122. encrypts  voice and computer data transmissions, that could be converted to
  3123. the Clipper technology, said spokesman Bill Jones.
  3124.  
  3125.   Jones  said  he  wasn't  aware  of any concern by the government over the
  3126. current  model  of  the  Telephone  Security Device, which has been sold to
  3127. government and business customers.
  3128.  
  3129.   At least one company was quite pleased with the plan: San Jose chip maker
  3130. VLSI  Technology,  which  will  manufacture  the   Clipper    chips   for a
  3131. Torrance company that is selling them to the government and to AT&T.
  3132.  
  3133.   VLSI,  which  invented  a  manufacturing method the company said makes it
  3134. difficult  to "reverse engineer" the chip or discern the encryption scheme,
  3135. expects  to  make  $50  million in the next three years selling the device,
  3136. said Jeff Hendy, director of new product marketing for the company.
  3137.  
  3138. ------------------------------
  3139.  
  3140. Date: Thu Apr 15 11:47:00 +0200 1993
  3141. From: createuraltern.com (Fabien Pigere )
  3142. Subject: File 5--Piratage France Telecom par un technicien France Telecom
  3143. Copyright: Elsevier Science Publishers Ltd., 1992
  3144.  
  3145. ADDING TO CHAOS
  3146. Network Monitor      March, 1992
  3147. ISSN: 0953-8402               WORD COUNT: 121
  3148. PUBLISHER:  Elsevier Advanced Technology Publications
  3149.  
  3150. France  Telecom was in the news again recently after a technician was found
  3151. guilty  of  aiding  hackers  to  gain information about using international
  3152. network connections.
  3153.  
  3154. The  technician  worked for Intelcom France, an FT subsidiary which manages
  3155. the international transit node (NTI) for France Telecom networks.
  3156.  
  3157. According  to  the  police  the technician "played a determine role" in the
  3158. leak of NTI access codes notably to the Chaos Computer Club France.
  3159.  
  3160. Jean-Bernard Condat of the CCCF denied the accusation that his organization
  3161. which he says specializes in the security of information systems,  received
  3162. the access codes from the technician.
  3163.  
  3164. The  Chaos  Computer  Club  began life in Germany and has played a twilight
  3165. role,  half  supporting hackers and half finding security loopholes ignored
  3166. or hidden by suppliers and operations.
  3167.  
  3168. INDUSTRY:  Telecommunications (TL)
  3169.  
  3170. ------------------------------
  3171.  
  3172. End of Chaos Digest #1.19
  3173. ************************************
  3174. 
  3175. 
  3176. Path: ucivax!gateway
  3177. From: sidar@complex.is (Sigurdur Darri)
  3178. Subject: xtnd system
  3179. Message-ID: <199304271301.AA29312@krafla.rhi.hi.is>
  3180. Newsgroups: fa.think-c
  3181. X-Charset: ASCII
  3182. Lines: 28
  3183. Date: 27 Apr 93 13:01:46 GMT
  3184. X-Char-Esc: 29
  3185.  
  3186.    I'm using the XTND system to process a file and hyphnate it. Recently
  3187. I discovered strange bugs occuring in microsoft word files, which seemed
  3188. to happen at most bizarre times like f.inst. if I had a paragraph with a
  3189. length
  3190. over 150 bytes and a picture after that, then the picture would vanish.
  3191. After heavy use of the think c debugger and much coffee the simple solution
  3192. appeared to be that the field totalCharCount in the xtnd system which
  3193. usually
  3194. doesnt matter is needed for all word files (not just word 3.0 as the
  3195. comments
  3196. in the header file say) with strange things happening if it is not valid.
  3197. However I have some difficulties in knowing the excact size of the file
  3198. when I create it. Of course I could create temporary files and use them to
  3199. find the target text length but that would be rather timeconsuming.
  3200.  
  3201. So.. does anyone have any experience with the word translator? Do you know
  3202. if there is a way to use it without having to set this totalcharcount, or
  3203. what limits there are on the value of it being the excactly right one?
  3204.  
  3205. thanks,
  3206.  
  3207.  Sigurdur.
  3208. ---
  3209.   _/_/  Sigurdur Darri Skulason         email:     sidar@complex.is
  3210.  _/_/   Softis hf.                                 sidar@softis.is
  3211. _/_/    Macintosh Division                         sidar@rhi.hi.is
  3212. ---                                     Applelink: ICE0008
  3213.  
  3214. 
  3215. 
  3216. Path: ucivax!gateway
  3217. From: igorl@uiuc.edu (Igor Livshits)
  3218. Subject: Is main() required in all code resourcves?
  3219. X-Sender: igorl@ncsa.uiuc.edu
  3220. Message-ID: <9304271710.AA01280@mars.ncsa.uiuc.edu>
  3221. Newsgroups: fa.think-c
  3222. Lines: 12
  3223. Date: 27 Apr 93 17:10:50 GMT
  3224.  
  3225. Howdy,
  3226.  
  3227. I am trying to write a custom code resource (a plug-in module) which will
  3228. be nothing but a set of functions called by the main application.  Why
  3229. would I need need a main() for  such a code resource?  The THINK C manual
  3230. seems to imply that I need a main90 for every such code resource.
  3231.  
  3232. Thank you for your help,
  3233. Igor
  3234. _____
  3235. NCSA-UIUC,  e:igorl@uiuc.edu,  p:(217) 244-0424
  3236.  
  3237. 
  3238. 
  3239. Path: ucivax!gateway
  3240. From: inei@dcs.gla.ac.uk (inei)
  3241. Subject: How to find folder name after FindFolder()?
  3242. Message-ID: <9304271750.AA20767@albatross.dcs.gla.ac.uk>
  3243. Newsgroups: fa.think-c
  3244. Lines: 15
  3245. Date: 27 Apr 93 17:52:14 GMT
  3246.  
  3247.  
  3248. Someone please help me before I tear all my hair out!
  3249.  
  3250. I am trying to get the pathname of the System file.
  3251.  
  3252. I've used FindFolder() which dutifully gives me the volume reference
  3253. number and the directory ID of the System Folder.  Now I want to
  3254. OpenResFile() the System file, so I would like to get the pathname
  3255. of the System file.  Given only the System Folder's volume reference
  3256. number and directory ID, how do I find out the system folder's name?
  3257.  
  3258. Mail:  Nick Nei, Computing Science Dept.,
  3259.        Glasgow Univ., 17 Lilybank Gardens,
  3260.        Glasgow G12 8QQ, UK.  Tel: (041) 339 8855 x 5457
  3261. ARPA:  inei%uk.ac.glasgow.dcs@nsfnet-relay.ac.uk USENET: inei@cs.glasgow.uucp
  3262. 
  3263. 
  3264. Path: ucivax!gateway
  3265. From: gurgle@netcom.com (Pete Gontier)
  3266. Subject: Re: Is main() required in all code resourcves?
  3267. Message-ID: <9304271917.AA29524@netcom4.netcom.com>
  3268. In-Reply-To: <9304271710.AA01280@mars.ncsa.uiuc.edu>; from "Igor Livshits" at Apr 27, 93 5:10 pm
  3269. X-Mailer: ELM [version 2.3 PL11]
  3270. Newsgroups: fa.think-c
  3271. Lines: 23
  3272. Date: 27 Apr 93 19:19:20 GMT
  3273.  
  3274. > I am trying to write a custom code resource (a plug-in module) which will
  3275. > be nothing but a set of functions called by the main application.  Why
  3276. > would I need need a main() for  such a code resource?  The THINK C manual
  3277. > seems to imply that I need a main90 for every such code resource.
  3278.  
  3279. In general, you don't *need* a main to link. For example, a Windows
  3280. DLL is quite happy without one. An MPW code resource is, too, although
  3281. you do still have to specify the name of the primary entry point.
  3282.  
  3283. The trick here is that the THINK C linker expects there to be a
  3284. main.  The various pieces of startup code produced by THINK C each do
  3285. a subroutine call to main. Whether that is good or bad is left as an
  3286. exercise.
  3287.  
  3288. What *you* might find main useful for is setting up a block full of
  3289. function addresses for the benefit of the caller. You'll have to
  3290. figure out some way to do this to achieve what you want anyway, and
  3291. in many ways doing this sort of work in main is a lot easier than
  3292. alternatives like parsing the link map. And more resistant to changes
  3293. in the complier, too.
  3294.  
  3295. --
  3296.  Pete Gontier // EC Technology // gurgle@netcom.com
  3297. 
  3298. 
  3299. Path: ucivax!gateway
  3300. From: rmah@panix.com (Robert Mah)
  3301. Subject: Re: Is main() required in all code resourcves?
  3302. Message-ID: <Pine.3.05.9304271845.A13260-a100000@sun.panix.com>
  3303. In-Reply-To: <9304271710.AA01280@mars.ncsa.uiuc.edu>
  3304. Content-Type: TEXT/PLAIN; charset=US-ASCII
  3305. Mime-Version: 1.0
  3306. Newsgroups: fa.think-c
  3307. Lines: 24
  3308. Date: 27 Apr 93 22:44:23 GMT
  3309.  
  3310. Igor,
  3311.  
  3312. On 27 Apr 1993, Igor Livshits wrote:
  3313.  
  3314. > I am trying to write a custom code resource (a plug-in module) which will
  3315. > be nothing but a set of functions called by the main application.  Why
  3316. > would I need need a main() for  such a code resource?
  3317.  
  3318. main() is used as the entry point.  The linker makes sure that main() is
  3319. called before any other function.  If this wasn't the case, you'd have
  3320. to worry about the order of the functions in your project -- not real fun.
  3321.  
  3322. BTW, what program is the plug-in for?  The "host" software determines
  3323. how you should declare your main().
  3324.  
  3325. Cheers,
  3326. Rob
  3327.  
  3328. [----------------------------------------------------------------------]
  3329. [ Robert S. Mah   | Voice: 212-947-6507   | "Every day an adventure,   ]
  3330. [ One Step Beyond | EMail: rmah@panix.com |  every moment a challenge" ]
  3331. [----------------------------------------------------------------------]
  3332.  
  3333.  
  3334. 
  3335. 
  3336. Path: ucivax!gateway
  3337. From: rmah@panix.com (Robert Mah)
  3338. Subject: Re: How to find folder name after FindFolder()?
  3339. Message-ID: <Pine.3.05.9304271827.A13260-a100000@sun.panix.com>
  3340. In-Reply-To: <9304271750.AA20767@albatross.dcs.gla.ac.uk>
  3341. Content-Type: TEXT/PLAIN; charset=US-ASCII
  3342. Mime-Version: 1.0
  3343. Newsgroups: fa.think-c
  3344. Lines: 25
  3345. Date: 27 Apr 93 22:47:09 GMT
  3346.  
  3347. Nick,
  3348.  
  3349. On 27 Apr 1993, inei wrote:
  3350.  
  3351. > I've used FindFolder() which dutifully gives me the volume reference
  3352. > number and the directory ID of the System Folder.  Now I want to
  3353. > OpenResFile() the System file, so I would like to get the pathname
  3354. > of the System file.  Given only the System Folder's volume reference
  3355. > number and directory ID, how do I find out the system folder's name?
  3356.  
  3357. You can use HOpenResFile() instead of OpenResFile() which accepts a dirID,
  3358. a volume refnum and the filename.
  3359.  
  3360. However, if you still need to find the path, there's a code snippet from
  3361. DTS that can be found via anon ftp on ftp.apple.com that does it.
  3362.  
  3363. Cheers,
  3364. Rob
  3365.  
  3366. [----------------------------------------------------------------------]
  3367. [ Robert S. Mah   | Voice: 212-947-6507   | "Every day an adventure,   ]
  3368. [ One Step Beyond | EMail: rmah@panix.com |  every moment a challenge" ]
  3369. [----------------------------------------------------------------------]
  3370.  
  3371.  
  3372. 
  3373. 
  3374. Path: ucivax!gateway
  3375. From: igorl@uiuc.edu (Igor Livshits)
  3376. Subject: Re: Is main() required in all code resourcves?
  3377. X-Sender: igorl@ncsa.uiuc.edu
  3378. Message-ID: <9304272300.AA04948@mars.ncsa.uiuc.edu>
  3379. Newsgroups: fa.think-c
  3380. Lines: 38
  3381. Date: 27 Apr 93 23:01:03 GMT
  3382.  
  3383. Thank you to everyone who responded.  Sorry, Pete, you'll get two copies fo
  3384. this...
  3385.  
  3386. I think my confusion stems from the fact that MPW does not require this and
  3387. that some sample MPW code that I am trying to port to THINK C refuses to
  3388. work without a main().
  3389.  
  3390. I am trying to write a fader for the free screen saver Dark Side of the
  3391. Mac.  The example fader code does not have a main.  I believe the MPW
  3392. compiler assumes that the first function (no mattert the name) is the entry
  3393. point.  As such, can I take the MPW source, rename the first entry function
  3394. to main() and live happily ever after?
  3395.  
  3396. From the makefile:
  3397. "{OutputDir}"Invert ff "{ObjDir}"Invert.c.o "{ObjDir}"Fader.c.o
  3398.         Echo "Linking Invert"
  3399.         Link {LinkOptions} -o {Targ} d
  3400.         -m FaderEntry d
  3401.         -rt FADE=128 d
  3402.         -sg Fader  d
  3403.         "{ObjDir}Fader.c.o" d
  3404.         "{ObjDir}Invert.c.o"  d
  3405.         "{Libraries}"Runtime.o
  3406.         SetFile {Targ} -t 'Dark' -c 'DSOM'
  3407.  
  3408. Is the -m line the one that designates the first function?
  3409.  
  3410.  
  3411. BTW, if anyone has Dark Side fader example code in the THINK C dialect they
  3412. are willing to share, it would make me ecstatic.
  3413.  
  3414. I should probably talk to Tom Dowdy about this anyway...
  3415.  
  3416. Again, thanks for your input;
  3417. igor
  3418. _____
  3419. NCSA-UIUC,  e:igorl@uiuc.edu,  p:(217) 244-0424
  3420.  
  3421. 
  3422. 
  3423. Path: ucivax!gateway
  3424. From: kkirksey@world.std.com (Ken B Kirksey)
  3425. Subject: SANE Strangeness?
  3426. Message-ID: <199304292032.AA20980@world.std.com>
  3427. Newsgroups: fa.think-c
  3428. Lines: 49
  3429. Date: 29 Apr 93 20:32:40 GMT
  3430.  
  3431.  
  3432. Got a real headscratcher here. Well, it's a headscratcher to me;  I'm
  3433. sure one of you Think gurus out there will know what the problem is right
  3434. off. :-)
  3435.  
  3436. I just got the demo version of Inside Out II yesterday and I was having a
  3437. heck of time getting the demo program to compile.  I was getting the error
  3438.  
  3439.       "Second argument to function _elems1 does not match prototype."
  3440.  
  3441. on the line
  3442.  
  3443.       dh = 200 + 110 * sin (lineAng * 0.01745); /*</360 * 29 = RAD*/
  3444.  
  3445. where dh is a double and lineAng is a short.
  3446.  
  3447. I did some digging and found the SANE defintion of sine in SANE.h as
  3448.  
  3449.         #define sin(x)  _elems1(FSINX, x)
  3450.  
  3451. and _elems1 in sane4.c as
  3452.  
  3453.         _elems1(short op, extended x)
  3454.  
  3455. So it's complaining that the argument to the sin call (lineAng * 0.0175)
  3456. isn't of type extended (a SANE type?).  I know nothing of SANE, so I really
  3457. don't know what's going on here.  Can someone tell my why it's griping about
  3458. this.  The tech support guy at Sierra told me that they've gotten it to
  3459. compile with no problem.  I could only get it to compile when I commented out
  3460. the #include <SANE.h> line.  It compiled and ran fine when I did that.
  3461.  
  3462. FYI, it give the same error whether or not "Strict prototype enforcement"
  3463. is checked.  I had to turn off "check pointer types" because it really choked on
  3464. compile with that one.  This is definitely not ANSI conformant code. :-(
  3465.  
  3466. Many thanks in advance.
  3467.  
  3468.  
  3469.                           Ken
  3470.  
  3471. +------------------------+--------------------------------------------------+
  3472. | Ken Kirksey            | Someone who actually understands and generates   |
  3473. | Mac Guru & Developer   | unique JCL is regarded with the mixed respect    |
  3474. | kkirksey@world.std.com | one give to someone who memorizes the phone book.|
  3475. |                        |                        - Eric Raymond            |
  3476. +------------------------+--------------------------------------------------+
  3477. | PGP 2.0 Key available via finger or keyserver.                            |
  3478. +---------------------------------------------------------------------------+
  3479.  
  3480. 
  3481. 
  3482. Path: ucivax!gateway
  3483. From: C511899@mizzou1.missouri.edu (Andrew McAllister)
  3484. Subject: curses, curses, curses.h,curses.c
  3485. Message-ID: <9304292018.aa10468@q2.ics.uci.edu>
  3486. Newsgroups: fa.think-c
  3487. Lines: 14
  3488. Date: 30 Apr 93 03:18:52 GMT
  3489.  
  3490. Sorry about all the cursing on the net :), but does anybody know what this
  3491. curses.h and curses.c stuff is? I've got a bunch of source code that is
  3492. supposed to compile on a unix machine with the curses libraries. Well,
  3493. since Think C has a unix lib and is generally the best compiler for the
  3494. Mac, I thought I'd try to compile said code. But curses, lots of errors.
  3495.  
  3496. Here's what I'm looking for: Has anyone implemented the curses libraries
  3497. for the mac? I think they are designed to do terminal I/O on stupid terminals,
  3498. like the console in Think C. I know the console can do some cool stuff, like
  3499. clearing the screen, positioning the cursor etc. How do these functions
  3500. relate to the curses libs? Yikes! I don't really have access to a unix box
  3501. so I can't really do any testing or look at the curses headers etc.
  3502. Help???!??
  3503. andy     c511899@mizzou1.missouri.edu
  3504. 
  3505. 
  3506. Path: ucivax!gateway
  3507. From: sarago@paola.dei.unipd.it (Tomaso Paoletti 345392/IL)
  3508. Subject: request of submission
  3509. Message-ID: <9304301214.AA19114@paola.dei.unipd.it>
  3510. Newsgroups: fa.think-c
  3511. Lines: 8
  3512. Date: 30 Apr 93 12:09:20 GMT
  3513.  
  3514. I would like to submit to the Think-C mailing list
  3515. with a different e-mail address:
  3516.  
  3517.     sarago@maya.dei.unipd.it
  3518.  
  3519. Tomaso Paoletti, sarago@paola.dei.unipd.it
  3520.  
  3521.         Thanks in advance
  3522. 
  3523. 
  3524. Path: ucivax!gateway
  3525. From: igorl@uiuc.edu (Igor Livshits)
  3526. Subject: BackgroundOnly and the debugger
  3527. X-Sender: igorl@ncsa.uiuc.edu
  3528. Message-ID: <9304301935.AA18256@mars.ncsa.uiuc.edu>
  3529. Newsgroups: fa.think-c
  3530. Lines: 16
  3531. Date: 30 Apr 93 19:36:11 GMT
  3532.  
  3533. Howdy,
  3534.  
  3535. Am I correct in assuming that I cannot use the Think C Debugger with
  3536. background-only applications?  If I can, please tell me how.
  3537.  
  3538. I have written a bg-only application that seems to work when a stand-alone.
  3539.  When I try to run it as a project with the Debugger, the process register
  3540. under the Aplication menu (it should not), and when I quit it leaves a
  3541. ghost.  The Finder promptly crashes after the bg-only app is terminated in
  3542. the latter case.
  3543.  
  3544. Thanks for your help,
  3545. igor
  3546. _____
  3547. NCSA-UIUC,  e:igorl@uiuc.edu,  p:(217) 244-0424
  3548.  
  3549. 
  3550.